Skip to content

Package

Package #6

Workflow file for this run

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:
FLUTTER_VERSION: '3.7.3'
GO_VERSION: '1.18'
jobs:
package:
strategy:
fail-fast: false
matrix:
config:
- target: ios
host: macos-latest
- target: android
host: ubuntu-latest
runs-on: ${{ matrix.config.host }}
steps:
- name: need_build
id: need_build
run: |
if [ '${{ matrix.config.target }}' == 'android' ] && [ ${{ github.event.inputs.PACKAGE_ANDROID }} == 'true' ]; then
echo "::set-output name=need_build::true"
elif [ ${{ matrix.config.target }} == 'ios' ] && [ ${{ github.event.inputs.PACKAGE_IOS }} == 'true' ]; then
echo "::set-output name=need_build::true"
else
echo "::set-output name=need_build::false"
fi
- if: steps.need_build.outputs.need_build == 'true'
name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
architecture: x64
- if: steps.need_build.outputs.need_build == 'true'
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- if: steps.need_build.outputs.need_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: steps.need_build.outputs.need_build == 'true'
name: checkout
uses: actions/checkout@v3
- if: steps.need_build.outputs.need_build == 'true'
name: checkout core
uses: actions/checkout@v3
with:
repository: 'niuhuan/pikapika-go-core'
token: ${{ secrets.GH_TOKEN }}
path: 'go'
- if: steps.need_build.outputs.need_build == 'true'
name: Set-Version (All)
run: |
cd ci
cp version.code.txt ../lib/assets/version.txt
- if: steps.need_build.outputs.need_build == 'true'
name: Install go mobile (mobile)
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'ios'
name: Build (ios)
run: |
sh scripts/build-ipa.sh
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
name: Build (android-arm64)
env:
KEY_FILE_BASE64: ${{ secrets.KEY_FILE_BASE64 }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
sh scripts/build-apk-arm64.sh
sh scripts/sign-apk-github-actions.sh
- if: steps.need_build.outputs.need_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: steps.need_build.outputs.need_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