Skip to content

fix(version)

fix(version) #7

Workflow file for this run

name: app-build-action
#推送Tag时触发
on:
push:
tags:
- "*"
jobs:
build-mac-ios-android:
runs-on: macos-latest
permissions:
contents: write
steps:
#签出代码
- uses: actions/checkout@v3
with:
ref: master
#APK签名设置
- name: Create the Keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
run: |
# import keystore from secrets
ls -all
echo $KEYSTORE_BASE64 | base64 -di > android/key.jks
echo $KEY_PROPERTIES | base64 -di > android/key.properties
#设置JAVA环境
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "12.x"
cache: 'gradle'
#设置Flutter
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.9'
cache: true
#更新Flutter的packages
- name: Restore packages
run: |
flutter pub get
#打包APK
- name: Build APK_SPLIT
run: |
flutter build apk --split-per-abi
- name: Build APK
run: |
flutter build apk
#上传APK至Artifacts
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: |
build/app/outputs/flutter-apk/app-release.apk
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
build/app/outputs/flutter-apk/app-x86_64-release.apk
#读取版本信息
- name: Read version
id: version
uses: juliangruber/read-file-action@v1
with:
path: assets/version.json
- name: Echo version
run: echo "${{ fromJson(steps.version.outputs.content).version }}"
- name: Echo version content
run: echo "${{ fromJson(steps.version.outputs.content).version_desc }}"
#上传至Release
- name: Upload Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "build/app/outputs/flutter-apk/app-x86_64-release.apk,build/app/outputs/flutter-apk/app-arm64-v8a-release.apk,build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk,build/app/outputs/flutter-apk/app-release.apk"
name: "${{ fromJson(steps.version.outputs.content).version }}"
body: "${{ fromJson(steps.version.outputs.content).version_desc }}"
prerelease: ${{ fromJson(steps.version.outputs.content).prerelease }}
token: ${{ secrets.TOKEN }}
#完成
- run: echo "🍏 This job's status is ${{ job.status }}."