👷 add package ci scripts

This commit is contained in:
niuhuan 2024-04-02 13:20:20 +08:00
parent 4b66b1bdb9
commit 7bc9b476cc
1 changed files with 98 additions and 0 deletions

98
.github/workflows/Package.yml vendored Normal file
View File

@ -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