👷 map build condition

This commit is contained in:
niuhuan 2024-04-02 13:32:23 +08:00
parent 31ea00b5af
commit a7ecfbd7d7
1 changed files with 21 additions and 13 deletions

View File

@ -27,28 +27,36 @@ jobs:
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: need_build
id: need_build
run: |
if [ ${{ matrix.config.target }} == 'android' ] && [ ${{ env.PACKAGE_ANDROID }} == 'true' ]; then
echo "::set-output name=need_build::true"
elif [ ${{ matrix.config.target }} == 'ios' ] && [ ${{ env.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: Set-Version (All)
run: |
cd ci
cp version.code.txt ../lib/assets/version.txt
- if: ${{ matrix.config.build == 'true' }}
- 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: ${{ matrix.config.build == 'true' }}
- if: steps.need_build.outputs.need_build == 'true'
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- if: ${{ matrix.config.build == 'true' }}
- if: steps.need_build.outputs.need_build == 'true'
name: Cache go modules
uses: actions/cache@v3
with:
@ -58,25 +66,25 @@ jobs:
key: ubuntu-latest-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
ubuntu-latest-go-
- if: ${{ matrix.config.build == 'true' }}
- if: steps.need_build.outputs.need_build == 'true'
name: checkout
uses: actions/checkout@v3
- if: ${{ matrix.config.build == 'true' }}
- 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: ${{ matrix.config.build == 'true' }}
- if: steps.need_build.outputs.need_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'
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'ios'
name: Build (ios)
run: |
sh scripts/build-ipa.sh
- if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'android'
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
name: Build (android-arm64)
env:
KEY_FILE_BASE64: ${{ secrets.KEY_FILE_BASE64 }}
@ -84,14 +92,14 @@ jobs:
run: |
sh scripts/build-apk-arm64.sh
sh scripts/sign-apk-github-actions.sh
- if: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'ios'
- 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: ${{ matrix.config.build == 'true' }} && matrix.config.target == 'android'
- if: steps.need_build.outputs.need_build == 'true' && matrix.config.target == 'android'
name: 'Upload Artifact (ios)'
uses: actions/upload-artifact@v4
with: