2024-04-02 05:20:20 +00:00
|
|
|
name: Package
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2024-04-02 05:36:48 +00:00
|
|
|
PACKAGE_IOS:
|
2024-04-02 05:20:20 +00:00
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: 'iOS version'
|
|
|
|
required: true
|
2024-04-02 05:36:48 +00:00
|
|
|
PACKAGE_ANDROID:
|
2024-04-02 05:20:20 +00:00
|
|
|
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:
|
2024-04-02 05:32:23 +00:00
|
|
|
- name: need_build
|
|
|
|
id: need_build
|
|
|
|
run: |
|
2024-04-02 05:39:21 +00:00
|
|
|
if [ '${{ matrix.config.target }}' == 'android' ] && [ ${{ github.event.inputs.PACKAGE_ANDROID }} == 'true' ]; then
|
2024-04-02 05:32:23 +00:00
|
|
|
echo "::set-output name=need_build::true"
|
2024-04-02 05:42:19 +00:00
|
|
|
elif [ ${{ matrix.config.target }} == 'ios' ] && [ ${{ github.event.inputs.PACKAGE_IOS }} == 'true' ]; then
|
2024-04-02 05:32:23 +00:00
|
|
|
echo "::set-output name=need_build::true"
|
|
|
|
else
|
|
|
|
echo "::set-output name=need_build::false"
|
|
|
|
fi
|
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: Setup flutter
|
|
|
|
uses: subosito/flutter-action@v2
|
|
|
|
with:
|
|
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
|
|
architecture: x64
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
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-
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: checkout
|
|
|
|
uses: actions/checkout@v3
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: checkout core
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: 'niuhuan/pikapika-go-core'
|
|
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
path: 'go'
|
2024-04-02 05:42:19 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
|
|
|
name: Set-Version (All)
|
|
|
|
run: |
|
|
|
|
cd ci
|
|
|
|
cp version.code.txt ../lib/assets/version.txt
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: Install go mobile (mobile)
|
|
|
|
run: |
|
|
|
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'ios'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: Build (ios)
|
|
|
|
run: |
|
|
|
|
sh scripts/build-ipa.sh
|
2024-04-02 06:45:17 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
|
|
|
|
name: Setup java (Android)
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
2024-04-02 10:41:48 +00:00
|
|
|
java-version: '11'
|
2024-04-02 06:45:17 +00:00
|
|
|
distribution: 'temurin'
|
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
|
|
|
|
name: Setup android tools (Android)
|
|
|
|
uses: android-actions/setup-android@v3
|
|
|
|
with:
|
2024-04-02 10:41:48 +00:00
|
|
|
cmdline-tools-version: 8512546
|
2024-04-02 07:14:43 +00:00
|
|
|
packages: 'platform-tools platforms;android-32 build-tools;30.0.2 ndk;23.1.7779620'
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: Build (android-arm64)
|
2024-04-02 05:23:35 +00:00
|
|
|
env:
|
|
|
|
KEY_FILE_BASE64: ${{ secrets.KEY_FILE_BASE64 }}
|
|
|
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
2024-04-02 05:20:20 +00:00
|
|
|
run: |
|
|
|
|
sh scripts/build-apk-arm64.sh
|
2024-04-02 05:23:35 +00:00
|
|
|
sh scripts/sign-apk-github-actions.sh
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'ios'
|
2024-04-02 05:20:20 +00:00
|
|
|
name: 'Upload Artifact (ios)'
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: 'nosign.ipa'
|
|
|
|
path: 'build/nosign.ipa'
|
|
|
|
retention-days: 3
|
2024-04-02 05:32:23 +00:00
|
|
|
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
|
2024-04-02 05:20:20 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|