Skip to content

Commit

Permalink
feat(CI): create release on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Yimura committed Sep 15, 2024
1 parent b429b0a commit bac2045
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- '**'

jobs:
ci:
name: Release Build
runs-on: ubuntu-latest
steps:
- name: Checking out branch
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@v3

# 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
mkdir -p keystore
base64 -d keystore-b64.txt > keystore/keystore.jks
- name: Ensure gradlew execute flags
run: |
chmod +x ./gradlew
- name: Build Release apk
env:
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: ./gradlew assembleRelease --stacktrace

- 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: Create Draft Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ steps.releaseApk.outputs.apkfile }}
${{ steps.releaseAab.outputs.aabfile }}
draft: true
prerelease: true
generate_release_notes: true

0 comments on commit bac2045

Please sign in to comment.