From 7bc9b476ccb5d7d69da6cd74fac9f86edc43529f Mon Sep 17 00:00:00 2001 From: niuhuan Date: Tue, 2 Apr 2024 13:20:20 +0800 Subject: [PATCH] :construction_worker: add package ci scripts --- .github/workflows/Package.yml | 98 +++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/Package.yml diff --git a/.github/workflows/Package.yml b/.github/workflows/Package.yml new file mode 100644 index 0000000..a96462a --- /dev/null +++ b/.github/workflows/Package.yml @@ -0,0 +1,98 @@ +name: Package +on: + workflow_dispatch: + inputs: + package-ios: + type: boolean + default: false + description: 'iOS version' + required: true + package-android: + type: boolean + default: false + description: 'Android version' + required: true + +env: + PACKAGE_IOS: ${{ github.event.inputs.message }} + PACKAGE_ANDROID: ${{ github.event.inputs.message }} + FLUTTER_VERSION: '3.7.3' + GO_VERSION: '1.18' + +jobs: + package: + strategy: + fail-fast: false + matrix: + config: + - target: ios + host: macos-latest + build: ${{ env.PACKAGE_IOS }} + - target: android + host: ubuntu-latest + build: ${{ env.PACKAGE_ANDROID }} + runs-on: ${{ matrix.config.host }} + steps: + - if: ${{ matrix.config.build == 'true' }} + name: Set-Version (All) + run: | + cd ci + cp version.code.txt ../lib/assets/version.txt + - if: ${{ matrix.config.build == 'true' }} + name: Setup flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + architecture: x64 + - if: ${{ matrix.config.build == 'true' }} + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - if: ${{ matrix.config.build == 'true' }} + name: Cache go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ubuntu-latest-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ubuntu-latest-go- + - if: ${{ matrix.config.build == 'true' }} + name: checkout + uses: actions/checkout@v3 + - if: ${{ matrix.config.build == 'true' }} + name: checkout core + uses: actions/checkout@v3 + with: + repository: 'niuhuan/pikapika-go-core' + token: ${{ secrets.GH_TOKEN }} + path: 'go' + - if: ${{ matrix.config.build == 'true' }} + name: Install go mobile (mobile) + run: | + go install golang.org/x/mobile/cmd/gomobile@latest + - if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'ios' + name: Build (ios) + run: | + sh scripts/build-ipa.sh + - if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'android' + name: Build (android-arm64) + run: | + sh scripts/build-apk-arm64.sh + - if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'ios' + name: 'Upload Artifact (ios)' + uses: actions/upload-artifact@v4 + with: + name: 'nosign.ipa' + path: 'build/nosign.ipa' + retention-days: 3 + - if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'android' + name: 'Upload Artifact (ios)' + uses: actions/upload-artifact@v4 + with: + name: 'app-release.apk' + path: 'build/app/outputs/flutter-apk/app-release.apk' + retention-days: 3 + +