Update CI to build and push on new release #10
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
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
release: | |
types: ["published"] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Project checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: gradle-deps-core-${{ hashFiles('**/build.gradle*') }} | |
restore-keys: | | |
gradle-deps | |
- name: Cache Gradle Build | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches/build-cache-* | |
key: gradle-builds-core-${{ github.sha }} | |
restore-keys: | | |
gradle-builds | |
- name: Signing key | |
run: | | |
echo "androidStorePassword=${{ secrets.KEY_STORE_PASSWORD }}" >> local.properties | |
echo "androidKeyAlias=${{ secrets.KEY_ALIAS }}" >> local.properties | |
echo "androidKeyPassword=${{ secrets.KEY_PASSWORD }}" >> local.properties | |
echo "androidStoreFile=aer_sign_keystore.jks" >> local.properties | |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then | |
echo '${{ secrets.KEY_STORE }}' | base64 --decode > aer_sign_keystore.jks | |
fi | |
- name: Build | |
id: build | |
run: | | |
echo 'org.gradle.caching=true' >> gradle.properties | |
echo 'org.gradle.parallel=true' >> gradle.properties | |
echo 'org.gradle.vfs.watch=true' >> gradle.properties | |
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties | |
./gradlew :app:assembleRelease | |
- name: Upload mappings | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mappings | |
path: "app/build/outputs/mapping/release" | |
- name: Upload apks to release assets | |
if: ${{ (github.event_name == 'release') }} | |
run: | | |
curl --fail -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.RELEASE_UPLOAD_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Content-Type: application/octet-stream" \ | |
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=aer-app-release.apk" \ | |
--data-binary "@app/build/outputs/apk/release/app-release.apk" |