flutter.yml: 修改当 Git 浅克隆时生成版本号的方式为依据编译编号或者日期
服务器只是浅克隆1层代码,有 GITHUB_RUN_NUMBER 的就依据此环境变量。 对于本地如果浅克隆,没有 GITHUB_RUN_NUMBER 的就依据编译日期。
This commit is contained in:
parent
9795f08fcd
commit
43ac139d90
|
@ -26,11 +26,17 @@ jobs:
|
|||
with:
|
||||
channel: 'stable' # or: 'dev' or 'beta'
|
||||
|
||||
- name: Export environment valiables
|
||||
run: export
|
||||
|
||||
- name: Create App version
|
||||
run: git fetch --tags; git tag; git log -n1; bash -x ./version.sh
|
||||
|
||||
- name: Print Flutter SDK version
|
||||
run: flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: ./version.sh; cd src/ui/flutter; flutter pub get; flutter pub global activate intl_utils; flutter --no-color pub global run intl_utils:generate
|
||||
run: cd src/ui/flutter; flutter pub get; flutter pub global activate intl_utils; flutter --no-color pub global run intl_utils:generate
|
||||
|
||||
# Uncomment this step to verify the use of 'dart format' on each commit.
|
||||
# - name: Verify formatting
|
||||
|
|
11
version.sh
11
version.sh
|
@ -24,8 +24,15 @@ if [ "$LOCALVER" -gt "1" ] ; then
|
|||
GIT_VERSION="$TAG r$VER"
|
||||
APP_VERSION="${TAG:1}+${LOCALVER-VER}"
|
||||
else
|
||||
GIT_VERSION=
|
||||
VER="x"
|
||||
DATE=$(date +%Y%m%d)
|
||||
if [ -n "$GITHUB_RUN_NUMBER" ] ; then
|
||||
VER="$GITHUB_RUN_NUMBER"
|
||||
GIT_VERSION="$TAG #$VER"
|
||||
else
|
||||
VER="${DATE:2}"
|
||||
GIT_VERSION="$TAG Build $VER"
|
||||
fi
|
||||
APP_VERSION="${TAG:1}+${VER}"
|
||||
fi
|
||||
|
||||
rm -f config.git-hash
|
||||
|
|
Loading…
Reference in New Issue