Skip to content

Build, sign and upload to GitHub Releases #27

Build, sign and upload to GitHub Releases

Build, sign and upload to GitHub Releases #27

name: Build, sign and upload to GitHub Releases
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
name: Build, sign and upload to GitHub Releases
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Save version name
run: |
echo 'VERSION_NAME<<EOF' >> $GITHUB_ENV
grep versionName app/build.gradle.kts | cut -d \" -f2 | cut -d \" -f1 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Save version code
run: |
echo 'VERSION_CODE<<EOF' >> $GITHUB_ENV
grep versionCode app/build.gradle.kts | grep -Eo '[0-9]+' | tail -1 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
- name: Save changelog
run: |
{
echo 'CHANGELOG<<EOF'
cat fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt
echo EOF
} >> $GITHUB_ENV
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Assemble release
run: ./gradlew assembleRelease
# See https://github.com/r0adkll/sign-android-release/issues/84
- name: Save installed BUILD_TOOL_VERSION
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo "Installed BUILD_TOOL_VERSION is: $BUILD_TOOL_VERSION"
- name: Sign release
uses: r0adkll/sign-android-release@v1
id: sign_release
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.KEYSTORE_BASE64 }}
alias: ${{ secrets.KEYSTORE_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Upload APK to GitHub release
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.sign_release.outputs.signedReleaseFile }}
body: ${{ env.CHANGELOG }}
tag: ${{ env.VERSION_NAME }}
asset_name: bura-$tag.apk