diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 4494055e..3ea88d2c 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -16,6 +16,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.branch }} + fetch-depth: 0 - name: Setup flutter uses: subosito/flutter-action@v2 @@ -26,6 +27,11 @@ jobs: - name: Set up xcode uses: BoundfoxStudios/action-xcode-select@v1 + - name: 更新版本号 + run: | + version_name=$(yq e '.version' pubspec.yaml | cut -d "+" -f 1) + sed -i '' "s/version: .*/version: $version_name+$(git rev-list --count HEAD)/" pubspec.yaml + - name: Build iOS run: | chmod +x lib/scripts/build.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 35def9d3..0d99a7cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,8 @@ jobs: steps: - name: 代码迁出 uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: 构建Java环境 uses: actions/setup-java@v4 @@ -34,6 +36,11 @@ jobs: - name: 下载项目依赖 run: flutter pub get + - name: 更新版本号 + run: | + version_name=$(yq e .version pubspec.yaml | cut -d "+" -f 1) + sed -i "s/version: .*/version: $version_name-$(git rev-parse --short HEAD)+$(git rev-list --count HEAD)/g" pubspec.yaml + - name: Write key run: | if [ ! -z "${{ secrets.SIGN_KEYSTORE_BASE64 }}" ]; then diff --git a/pubspec.yaml b/pubspec.yaml index 2e91bbde..dab9caba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,8 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.22+123 +# update when release +version: 1.1.0+1 environment: sdk: ">=3.0.0 <4.0.0"