Skip to content

CI / Guthub actions v2 #12

CI / Guthub actions v2

CI / Guthub actions v2 #12

Workflow file for this run

name: Release Build
# Preparation steps that can be used in other steps and workflows.
on:
workflow_dispatch:
inputs:
name:
description: "Release-Build"
default: "Generate release build"
pull_request:
branches: [ '*' ] # run on all pull requests
jobs:
build:
runs-on: macos-latest # use [ self-hosted, macOS ] to host on our own mac mini, which is twice as fast and cheaper than hosting on a github runner. See README for more info.
permissions: # TODO still needed?
packages: read
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: "21" # keep the same as your Android Studio version
cache: "gradle"
- name: Setup Android SDK
uses: android-actions/setup-android@v2.0.10
- name: Update version code # we increase the version code with each build
uses: chkfung/android-version-actions@v1.1
with:
gradlePath: app/build.gradle
versionCode: ${{ github.run_number }}
# This will decode the keystore from base 64 text representation that we have stored in secrets
# and generates and keystore file and gets stored in /android-app path
- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: |
echo $ENCODED_STRING > keystore-b64.txt
base64 -d <keystore-b64.txt >upload_keystore.jks
# - name: Prepare build
# uses: ./.github/workflows/_prepare.yml
- name: Build Release bundle
env:
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: ./gradlew bundleRelease --stacktrace
- name: Get release file aab path
id: releaseAab
run: echo "aabfile=$(find app/build/outputs/bundle/release/*.aab)" >> $GITHUB_OUTPUT
- name: Get release file apk path
id: releaseApk
run: echo "apkfile=$(find app/build/outputs/apk/release/*.apk)" >> $GITHUB_OUTPUT
- name: Upload Release Build to Artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: ${{ steps.releaseApk.outputs.apkfile }}
- name: Upload Release Build to Artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: ${{ steps.releaseApk.outputs.aabfile }}