Skip to content

Commit

Permalink
ADD github actions v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank1234 committed Jul 30, 2024
1 parent 44e0668 commit 2577a57
Show file tree
Hide file tree
Showing 13 changed files with 383 additions and 401 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/_prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Preparation
on:
workflow_call: # workflow_call means it will be invoked by another workflow and can't be executed on its own
name:
description: "Preparation"
default: "Preparations for all our builds"

jobs:
build:
runs-on: [ self-hosted, macOS ] # we host on our own mac mini, it's twice as fast as hosting on github
permissions:
packages: read
contents: read

steps:
- name: Checking out branch
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/[email protected]

- name: Update version code # we increase the version code with each build
uses: chkfung/[email protected]
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
43 changes: 0 additions & 43 deletions .github/workflows/pr.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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"

jobs:
uses: ./.github/workflows/_prepare.yml
build:
runs-on: [ self-hosted, macOS ] # we host on our own mac mini, it's twice as fast

steps:
- 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 }}
Empty file added .github/workflows/run_tests.yml
Empty file.
10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2577a57

Please sign in to comment.