Skip to content

Commit

Permalink
ci(Actions): Add apk signing to release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: arafaysaleem <[email protected]>
  • Loading branch information
arafaysaleem committed Jun 8, 2021
1 parent be898b0 commit d29ffef
Showing 1 changed file with 92 additions and 42 deletions.
134 changes: 92 additions & 42 deletions .github/workflows/PR-merge-build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,98 @@ on:

name: Build Release APK
jobs:
build:
flutter-setup:
if: github.event.pull_request.merged == true
name: build-release
name: Run Codegen and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Checkout Flutter Stable Channel
uses: subosito/[email protected]
with:
channel: 'stable'
- name: Get Pub Dependencies
run: flutter pub get
- name: Run build runner for codegen files
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Run Dart Analyzer
run: flutter analyze .
- name: Generate splitted release apks
run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi --obfuscate --split-debug-info=./ez_tickets_app/debug_trace
- name: Bump version and push tag
id: generate_tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor # major, minor, patch, false
custom_release_rules: "ci:patch:CI/CD,chore:patch:Chore Tasks,hotfix:minor:Bug Fixes,refact:patch:Refactors,docs:patch:Documentation Changes,build:patch:Build System/Dependency Upgrades"
- name: Upload release apk to artifacts
uses: ncipollo/[email protected]
with:
tag: "${{ steps.generate_tag.outputs.new_tag }}"
artifacts: "build/app/outputs/flutter-apk/*.apk"
name: "Release ${{ steps.generate_tag.outputs.new_tag }}"
body: "${{ steps.generate_tag.outputs.changelog }}"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload apks to google drive
uses: mkrakowitzer/actions-googledrive@1
with:
upload-from: ./build/app/outputs/apk/release/
upload-to: APKS/ez_tickets_app/
skicka-tokencache-json: ${{ secrets.SKICKA_TOKENCACHE_JSON }}
google-client-id: ${{ secrets.DRIVE_CLIENT_ID }}
google-client-secret: ${{ secrets.DRIVE_CLIENT_SECRET }}
remove-outdated: 'false'
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Checkout Flutter Stable Channel
uses: subosito/[email protected]
with:
channel: 'stable'
- name: Get Pub Dependencies
run: flutter pub get
- name: Run build runner for codegen files
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Run Dart Analyzer
run: flutter analyze .

assemble-release:
name: Setup signing keys
runs-on: ubuntu-latest
env:
ENCRYPTED_KEYSTORE: ${{ secrets.ENCRYPTED_KEYSTORE }}
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
steps:
- uses: actions/checkout@v2
- name: Load and decrypt keystore #destination of both should be the android folder
run: |
echo "$ENCRYPTED_KEYSTORE" > "$KEYSTORE_FILENAME.asc"
gpg -d --passphrase "$KEYSTORE_PASSPHRASE" --batch "$KEYSTORE_FILENAME.asc" > "./android/$KEYSTORE_FILENAME"
- name: Generate key properties
run: |
echo "storeFile=$KEYSTORE_FILENAME" > ./android/key.properties
echo "storePassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyPassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyAlias=$KEY_ALIAS" > ./android/key.properties
build-release:
needs: [flutter-setup,assemble-release]
name: Build Release APKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Checkout Flutter Stable Channel
uses: subosito/[email protected]
with:
channel: 'stable'
- name: Get Pub Dependencies
run: flutter pub get
- name: Run build runner for codegen files
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Generate splitted release apks
run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi --obfuscate --split-debug-info=./ez_tickets_app/debug_trace

release-artifacts-upload:
needs: [build-release]
name: Upload APKS to release artifacts
runs-on: ubuntu-latest
steps:
- name: Bump version and push tag
id: generate_tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor # major, minor, patch, false
custom_release_rules: "ci:patch:CI/CD,chore:patch:Chore Tasks,hotfix:minor:Bug Fixes,refact:patch:Refactors,docs:patch:Documentation Changes,build:patch:Build System/Dependency Upgrades"
- name: Upload release apk to artifacts
uses: ncipollo/[email protected]
with:
tag: "${{ steps.generate_tag.outputs.new_tag }}"
artifacts: "build/app/outputs/flutter-apk/*.apk"
name: "Release ${{ steps.generate_tag.outputs.new_tag }}"
body: "${{ steps.generate_tag.outputs.changelog }}"
token: ${{ secrets.GITHUB_TOKEN }}

google-drive-upload:
needs: [build-release]
name: Upload APKS to google drive
steps:
- name: Upload apks to google drive
uses: mkrakowitzer/actions-googledrive@1
with:
upload-from: ./build/app/outputs/flutter-apk/
upload-to: APKS/ez_tickets_app/
skicka-tokencache-json: ${{ secrets.SKICKA_TOKENCACHE_JSON }}
google-client-id: ${{ secrets.DRIVE_CLIENT_ID }}
google-client-secret: ${{ secrets.DRIVE_CLIENT_SECRET }}
remove-outdated: 'false'

0 comments on commit d29ffef

Please sign in to comment.