bump version #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Action to automatically build the project when a new tag is created | |
# always uses the 'main' branch for building | |
# also, this action runs unit tests before the build (only published as artifact) | |
name: Build and Publish | |
on: | |
# new tag pushed | |
push: | |
tags: | |
- '*' | |
# and manual run | |
workflow_dispatch: | |
jobs: | |
# build release | |
build_apk: | |
name: Build APK | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
JAVA_TOOL_OPTIONS: -Xmx5g -XX:+UseParallelGC | |
steps: | |
# setup env | |
- uses: actions/checkout@v2 | |
with: | |
ref: main | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- run: | | |
mkdir -p ~/.gradle | |
cp .github/gh-gradle.properties ~/.gradle/gradle.properties | |
chmod +x ./gradlew | |
# write sign.properties | |
- name: Write Signing Config | |
run: | | |
# write keystore | |
echo "${{ secrets.KEY_STORE }}" | base64 -d > ./keystore.jks | |
# write sign.properties | |
cat <<EOT > ./sign.properties | |
# key alias to use for application signing | |
key_alias=${{ secrets.ALIAS }} | |
# key password | |
key_password=${{ secrets.KEY_PASSWORD }} | |
# path of the keystore to use for signing | |
# relative to the project root (where this file also is) | |
keystore_path=keystore.jks | |
# password for the keystore | |
keystore_password=${{ secrets.KEY_STORE_PASSWORD}} | |
EOT | |
# run gradle build task | |
- name: Run build | |
uses: eskatos/gradle-command-action@v1 | |
with: | |
arguments: testDebugUnitTest assembleRelease | |
wrapper-cache-enabled: true | |
dependencies-cache-enabled: true | |
configuration-cache-enabled: true | |
# delete universal APK to slim down artifact upload | |
- run: rm -f ./app/build/outputs/apk/release/app-universal-release.apk | |
# print contents of artifact dir | |
- run: ls ./app/build/outputs/apk/release | |
# print contents of artifact dir | |
- run: ls ./app/build/test-results/testDebugUnitTest | |
# upload results | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: unit-test-results | |
path: ./app/build/test-results/testDebugUnitTest/*.xml | |
# upload artifacts | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: apks | |
path: ./app/build/outputs/apk/release/*.apk | |
# release to github | |
release_github: | |
name: Release On Github | |
needs: build_apk | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
# download artifacts | |
- run: mkdir ./release/ | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: apks | |
path: ./release/ | |
# print contents of artifact dir | |
- run: ls ./release | |
# calculate file hashes | |
- name: Calculate Hashes | |
id: apk_hash | |
shell: bash | |
run: | | |
echo ::set-output name=arm::$(sha256sum "./release/app-armeabi-v7a-release.apk") | |
echo ::set-output name=arm64::$(sha256sum "./release/app-arm64-v8a-release.apk") | |
echo ::set-output name=x86::$(sha256sum "./release/app-x86-release.apk") | |
echo ::set-output name=x64::$(sha256sum "./release/app-x86_64-release.apk") | |
# print hashes | |
- run: | | |
echo ${{ steps.apk_hash.outputs.arm }} | |
echo ${{ steps.apk_hash.outputs.arm64 }} | |
echo ${{ steps.apk_hash.outputs.x86 }} | |
echo ${{ steps.apk_hash.outputs.x64 }} | |
# create new release | |
- name: Create the Release | |
uses: ncipollo/release-action@v1 | |
with: | |
body: | | |
--- | |
APK Hashes: | |
- ${{ steps.apk_hash.outputs.arm }} | |
- ${{ steps.apk_hash.outputs.arm64 }} | |
- ${{ steps.apk_hash.outputs.x86 }} | |
- ${{ steps.apk_hash.outputs.x64 }} | |
> 🤖 this release was built automatically using Github Actions | |
artifacts: "./release/*.apk" | |
allowUpdates: true | |
omitBody: false | |
omitBodyDuringUpdate: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# remove artifacts | |
delete_artifacts: | |
name: Delete Artifacts | |
needs: release_github | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Delete Artifacts | |
uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: apks | |
failOnError: false |