Build Release APK #8
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
# This action is manually triggered. It will bump the version according to argument (major, minor, patch), | |
# commit the change to the development branch, get these values from version file, merge --no-ff the development branch into the master branch, | |
# build a release APK, sing it, and create a draft release on GitHub named after the new version name | |
# with the description having all commit messages since last tag. | |
# but that's in the future, for now we just want to build a release APK and create a draft release on GitHub. | |
name: Build Release APK | |
on: | |
workflow_dispatch: | |
#inputs: | |
# version: | |
# description: 'Version to bump to' | |
# required: true | |
# default: 'patch' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create local.properties | |
# run: echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties | |
# run: echo "sdk.dir=/opt/android/sdk" > local.properties | |
# run: echo "sdk.dir=$ANDROID_HOME" > local.properties | |
# run: echo "sdk.dir=/home/runner/work/_temp/_github_home/Android/sdk" > local.properties | |
run: touch local.properties | |
- name: Decode keystore | |
run: echo ${{ secrets.SIGNATURE_KEYSTORE_BASE64 }} | base64 --decode > android-keystore.jks | |
- name: Build with Gradle | |
env: | |
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
SIGNATURE_KEYSTORE_PASSWORD: ${{ secrets.SIGNATURE_KEYSTORE_PASSWORD }} | |
SIGNATURE_KEY_PASSWORD: ${{ secrets.SIGNATURE_KEY_PASSWORD }} | |
SIGNATURE_KEY_ALIAS: ${{ vars.SIGNATURE_KEY_ALIAS }} | |
run: ./gradlew assembleRelease | |
- name: Upload APK # can be removed after we upload to the release | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-release.apk | |
path: app/build/outputs/apk/release/app-release.apk | |
- name: Read version name | |
id: read_version_name | |
uses: ActionsTools/read-json-action@main | |
with: | |
file_path: "./app/version" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.read_version_name.outputs.major }}.${{ steps.read_version_name.outputs.minor }}.${{ steps.read_version_name.outputs.patch }} | |
release_name: ${{ steps.read_version_name.outputs.major }}.${{ steps.read_version_name.outputs.minor }}.${{ steps.read_version_name.outputs.patch }} | |
body: | | |
Changes in this Release | |
- <add changes here> | |
draft: true | |
prerelease: false | |
- name: Attach APK to Release | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./app/build/outputs/apk/release/app-release.apk | |
asset_name: app-release.apk | |
asset_content_type: application/vnd.android.package-archive |