use reusable workflow in "Create new release"

This commit is contained in:
Vadim 2024-02-21 16:43:34 +01:00
parent d4cc799405
commit b043d5cf0b
3 changed files with 10 additions and 97 deletions

View file

@ -12,11 +12,11 @@ on:
inputs:
version:
description: "Version"
required: true
required: false
type: string
build-number:
description: "Build number"
required: true
required: false
type: string
stage-backend:
description: "Use stage backend"
@ -47,7 +47,7 @@ jobs:
build:
name: Build .apk & .aab
runs-on: macos-11
timeout-minutes: 30
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:

View file

@ -47,7 +47,7 @@ jobs:
build:
name: Build .ipa
runs-on: macos-11
timeout-minutes: 30
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:

View file

@ -3,7 +3,6 @@
# separate terms of service, privacy policy, and support
# documentation.
# This workflow uses perl regex. For better syntaxis understading see these docs:
# https://perldoc.perl.org/perlrequick#Search-and-replace
# https://perldoc.perl.org/perlre#Other-Modifiers
@ -36,100 +35,14 @@ on:
description: Include IAP package
default: true
env:
BUILD_ARGS: --release --flavor prod -t lib/main_prod.dart
jobs:
build:
name: Build .apk & .aab
if: ${{ inputs.github-release || inputs.google-play-release }}
runs-on: macos-11
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Connect private iap package
uses: webfactory/ssh-agent@v0.8.0
if: ${{ inputs.include-iap }}
with:
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
- name: Override iap package with stub
if: ${{ !inputs.include-iap }}
run: bash ./.github/scripts/stub_iap.sh
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
- name: Restore Android keystore .jsk and .properties files
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
run: |
KEYSTORE_PATH=$RUNNER_TEMP/keystore.jks
echo -n "$KEYSTORE" | base64 --decode --output $KEYSTORE_PATH
cp $KEYSTORE_PATH ./android/app
KEYSTORE_PROPERTIES_PATH=$RUNNER_TEMP/key.properties
echo -n "$KEYSTORE_PROPERTIES" | base64 --decode --output $KEYSTORE_PROPERTIES_PATH
cp $KEYSTORE_PROPERTIES_PATH ./android
- name: Restore android/app/google-services.json
env:
GOOGLE_SERVICES_JSON_ANDROID: ${{ secrets.GOOGLE_SERVICES_JSON_ANDROID }}
run: |
GOOGLE_SERVICES_JSON_ANDROID_PATH=$RUNNER_TEMP/google-services.json
echo -n "$GOOGLE_SERVICES_JSON_ANDROID" | base64 --decode --output $GOOGLE_SERVICES_JSON_ANDROID_PATH
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
- name: Restore firebase_options.dart
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.FIREBASE_OPTIONS }}" "lib/firebase_options.dart"
- name: Restore constants.dart
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
# This step makes sense when Github release is enabled because this release increments the build number.
# Therefore here we have to increment it as well to build an apk with the same build number.
- name: Increment build number & replace version number
if: ${{ inputs.github-release }}
run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }}
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: '3.10.0'
- name: Prepare flutter project
run: |
flutter --version
flutter pub get
flutter pub run intl_utils:generate
- name: Build apk
if: ${{ inputs.github-release }}
run: flutter build apk $BUILD_ARGS
- name: Upload apk to artifacts
if: ${{ inputs.github-release }}
uses: actions/upload-artifact@v3
with:
name: m3_lightmeter_apk
path: build/app/outputs/flutter-apk/app-prod-release.apk
- name: Build appbundle
if: ${{ inputs.google-play-release }}
run: flutter build appbundle $BUILD_ARGS
- name: Upload app bundle to artifacts
if: ${{ inputs.google-play-release }}
uses: actions/upload-artifact@v3
with:
name: m3_lightmeter_bundle
path: build/app/outputs/bundle/prodRelease/app-prod-release.aab
uses: ./.github/workflows/build_apk.yml
secrets: inherit
with:
version: ${{ github.event.inputs.version }}
stage-backend: false
generate-release-notes:
name: Generate release notes
@ -269,7 +182,7 @@ jobs:
with:
name: m3_lightmeter_release
path: m3_lightmeter_release.zip
- name: Delete app bundle & merged native libs artifacts
if: ${{ always() }}
uses: geekyeggo/delete-artifact@v2