build: gradle 8.4 #17
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: Build | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-ecosystem/[email protected] | |
id: regex-match | |
with: | |
text: ${{ github.event.head_commit.message }} | |
regex: '^v[0-9]+\.[0-9]+\.[0-9]+$' | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Access Api keys | |
env: | |
clientId: ${{ secrets.CLIENT_ID }} | |
clientSecret: ${{ secrets.CLIENT_SECRET }} | |
path: app/src/main/res/values/secrets.xml | |
run: | | |
touch $path | |
echo \<resources\> >> $path | |
echo \<string name=\"CLIENT_ID\"\>$clientId\</string\> >> $path | |
echo \<string name=\"CLIENT_SECRET\"\>$clientSecret\</string\> >> $path | |
echo \</resources\> >> $path | |
- name: Build APK | |
id: build | |
run: bash ./gradlew assembleRelease | |
- name: Sign APK | |
id: sign_apk | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNINGKEYBASE64 }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEYSTOREPASSWORD }} | |
keyPassword: ${{ secrets.KEYPASSWORD }} | |
- name: Build Changelog | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
id: changelog | |
uses: ardalanamini/auto-changelog@v3 | |
with: | |
mention-authors: false | |
mention-new-contributors: false | |
include-compare: false | |
semver: false | |
- name: Create Release | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
body: ${{ steps.changelog.outputs.changelog }} | |
tag: ${{ github.event.head_commit.message }} | |
name: Release ${{ github.event.head_commit.message }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload APK | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{steps.sign_apk.outputs.signedReleaseFile}} | |
asset_name: app-release-signed-${{ github.event.head_commit.message }}.apk | |
asset_content_type: application/zip |