This repository was archived by the owner on Jul 17, 2025. It is now read-only.
fix: 用户页 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PiliPalaX Release | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths-ignore: | |
| - '**.md' | |
| - '**.txt' | |
| - '.github/**' | |
| - '.vscode/**' | |
| - '.idea/**' | |
| - '!.github/workflows/release.yml' | |
| jobs: | |
| build_matrix: | |
| name: Build Release (${{ matrix.target_platform }}) | |
| runs-on: ${{ matrix.build_os }} | |
| strategy: | |
| matrix: | |
| target_platform: [android-split-per-abi, android-universal, iOS] | |
| include: | |
| - build_os: ubuntu-latest | |
| - target_platform: iOS | |
| build_os: macos-latest | |
| outputs: | |
| new_version: ${{ steps.update_version.outputs.new_version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update version | |
| id: update_version | |
| run: | | |
| last_tag=$(git tag --sort=committerdate | tail -1) | |
| new_version_name=$(echo $last_tag | awk -F'[.+-]' '{$3++; print $1 "." $2 "." $3}') | |
| new_version_code=$(echo $last_tag | awk -F'+' '{$NF++; print $NF}') | |
| new_version=${new_version_name}-beta+${new_version_code} | |
| if [[ $(yq -r .version pubspec.yaml | egrep -o "^[0-9]+\.[0-9]+\.[0-9]+") > "$last_tag" ]]; then | |
| new_version=$(yq -r .version pubspec.yaml | cut -d "+" -f 1)+${new_version_code} | |
| fi | |
| yq ".version=\"${new_version}\"" pubspec.yaml > tmp.yaml | |
| mv tmp.yaml pubspec.yaml | |
| echo "new_version: $new_version" | |
| echo "new_version=$new_version" >> $GITHUB_OUTPUT | |
| - name: 安装Java环境 | |
| uses: actions/setup-java@v3 | |
| if: startsWith(matrix.target_platform, 'android') | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| token: ${{ secrets.GIT_TOKEN }} | |
| - name: 安装Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: 3.24.4 | |
| channel: stable | |
| - name: 修复Flutter 3.24中文字重异常 | |
| if: startsWith(matrix.target_platform, 'android') | |
| working-directory: ${{ env.FLUTTER_ROOT }} | |
| run: | | |
| git config user.name "orz12" | |
| git config user.email "orz12@test.com" | |
| curl https://gist.githubusercontent.com/VillagerTom/077315c7101182af8bf443bb506007d0/raw/6c2c735a761f5e819672680bbefe473b748aa211/flutter-3.24.4-fix.diff | git apply | |
| git commit -am "fix font weight issue" | |
| flutter --version | |
| - name: 下载依赖 | |
| run: flutter pub get | |
| - name: 解码生成 jks | |
| if: startsWith(matrix.target_platform, 'android') | |
| run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| - name: flutter build apk (universal) | |
| if: matrix.target_platform == 'android-universal' | |
| run: flutter build apk --release | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: flutter build apk (split-per-abi) | |
| if: matrix.target_platform == 'android-split-per-abi' | |
| run: flutter build apk --release --split-per-abi | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: flutter build ios | |
| if: matrix.target_platform == 'iOS' | |
| run: | | |
| flutter build ios --release --no-codesign | |
| ln -sf build/ios/iphoneos Payload | |
| zip -r9 app.ipa Payload/runner.app | |
| - name: 重命名安装包 | |
| if: startsWith(matrix.target_platform, 'android') | |
| run: | | |
| version_name=$(yq -e .version pubspec.yaml | cut -d "+" -f 1) | |
| for file in build/app/outputs/flutter-apk/app-*.apk; do | |
| if [[ $file =~ app-(.?*)release.apk ]]; then | |
| new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}${version_name}.apk" | |
| mv "$file" "$new_file_name" | |
| fi | |
| done | |
| - name: 重命名安装包(iOS) | |
| if: matrix.target_platform == 'iOS' | |
| run: | | |
| version_name=$(yq -e .version pubspec.yaml | cut -d "+" -f 1) | |
| for file in app.ipa; do | |
| new_file_name="build/Pili-${version_name}.ipa" | |
| mv "$file" "$new_file_name" | |
| done | |
| - name: 上传至Artifacts (${{ matrix.target_platform }}) | |
| if : startsWith(matrix.target_platform, 'android') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PiliPalaX-${{ matrix.target_platform }} | |
| path: build/app/outputs/flutter-apk/Pili-*.apk | |
| - name: 上传至Artifacts (iOS) | |
| if: matrix.target_platform == 'iOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PiliPalaX-iOS | |
| path: build/Pili-*.ipa | |
| upload: | |
| name: Upload Release | |
| runs-on: ubuntu-latest | |
| needs: build_matrix | |
| steps: | |
| - name: 从Artifacts下载 | |
| uses: actions/download-artifact@v4 | |
| - name: 上传至GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| artifacts: PiliPalaX-*/* | |
| prerelease: ${{ contains(needs.build_matrix.outputs.new_version, 'beta') }} | |
| tag: ${{ needs.build_matrix.outputs.new_version }} | |
| allowUpdates: true |