feat(ci-cd): Build and upload app on publish events

This commit is contained in:
Myzel394 2024-04-26 14:16:49 +02:00
parent 6d104f994d
commit 84da393e0d
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,34 @@
name: Prepare KeyStore
description: Write the KeyStore file and properties to disk
inputs:
signingStorePassword:
description: 'The password for the KeyStore'
required: true
signingKeyPassword:
description: 'The password for the Key'
required: true
signingKeyAlias:
description: 'The alias for the Key'
required: true
keyStoreBase64:
description: 'The KeyStore file encoded as base64'
required: true
runs:
using: composite
steps:
- name: Write Keystore file 🗄️
id: android_keystore
uses: timheuer/base64-to-file@v1.0.3
with:
fileName: key.jks
encodedString: ${{ inputs.keyStoreBase64 }}
- name: Write Keystore properties 🗝️
shell: bash
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > key.properties
echo "storePassword=${{ inputs.signingStorePassword }}" >> key.properties
echo "keyPassword=${{ inputs.signingKeyPassword }}" >> key.properties
echo "keyAlias=${{ inputs.signingKeyAlias }}" >> key.properties

View File

@ -0,0 +1,52 @@
name: Build and publish app
on:
release:
types: [ published ]
jobs:
release-app-github:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: Write KeyStore 🗝️
uses: ./.github/actions/prepare-keystore
with:
signingStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }}
signingKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
signingKeyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStoreBase64: ${{ secrets.KEYSTORE }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
cache: 'gradle'
- name: Build APKs 📱
run: ./gradlew assembleRelease
- name: Build AABs 📱
run: ./gradlew bundleRelease
- name: Upload APKs 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/apk/fdroid/release/*.apk
- name: Upload APKs bundles 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/bundle/fdroidRelease/*.aab