Skip to content

Building a release version apk file #56

Building a release version apk file

Building a release version apk file #56

name: build-release-android
run-name: Building a release version apk file
permissions:
contents: write
packages: write
deployments: write
issues: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
- name: Create the Keystore
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
run: |
# import keystore from secrets
echo $KEYSTORE_B64 | base64 -d > $RUNNER_TEMP/keystore.jks
- name: Create key.properties
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASS }}
KEY_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASS }}
run: |
echo -e "storePassword=$KEYSTORE_PASSWORD\nkeyPassword=$KEY_PASSWORD\nkeyAlias=$KEY_ALIAS\nstoreFile=$RUNNER_TEMP/keystore.jks" > android/key.properties
- name: Decode Android Service Account
run: echo "${{ secrets.SERVICE_ACCOUNT }}" | base64 --decode > store_credentials.json
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 1.0.0
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: Update pubspec.yaml
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'pubspec.yaml'
propertyPath: 'version'
value: "${{ steps.semvers.outputs.minor }}"
commitChange: false
- run: flutter pub get
- run: flutter gen-l10n
- name: 🚀 Shorebird Release
run: shorebird release android --artifact apk '--' --dart-define=BVS="Minor release ${{ steps.semvers.outputs.v_minor }} ShoreBird"
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: store_credentials.json
packageName: com.vypal.eduapge2
releaseFiles: build/app/outputs/bundle/release/app-release.aab
track: production
status: completed
mappingFile: build/app/outputs/mapping/release/mapping.txt
- run: cp "build/app/outputs/apk/release/app-release.apk" "EduPage2-${{ steps.semvers.outputs.v_minor }}.apk"
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.semvers.outputs.v_minor }}"
prerelease: false
title: "EduPage2 ${{ steps.semvers.outputs.v_minor }}"
files: |
EduPage2-${{ steps.semvers.outputs.v_minor }}.apk
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add pubspec.yaml
git add android/app/version.properties
git commit -m 'Bump version to ${{ steps.semvers.outputs.minor }} [no ci]'