Debug Release 3.2 (3205) #56
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 CI | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'app/**' | |
- 'gradle/**' | |
- 'build.gradle.kts' | |
- 'gradle.properties' | |
- 'settings.gradle.kts' | |
- '.github/workflows/ci.yml' | |
workflow_dispatch: | |
jobs: | |
buildMaster: | |
name: Build Ci APK from master | |
if: startsWith(github.ref, 'refs/heads/master') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r26d | |
- name: Get Commit Message | |
id: commitMessage | |
run: IN="${{ github.event.head_commit.message }}" && echo "::set-output name=message::${IN%%$'\n'*}" | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Cache build cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ github.workspace }}/.ccache | |
~/.gradle/caches/build-cache-* | |
key: ${{ runner.os }}-build-cache-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-cache- | |
- name: Extract branch name | |
shell: bash | |
run: echo "::set-output name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" | |
id: extract_branch | |
- name: File Permissions | |
run: chmod +x gradlew | |
- name: Accept Preview SDK License | |
run: echo -n -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > /usr/local/lib/android/sdk/licenses/android-sdk-preview-license | |
- name: Build apk | |
id: buildAllApks | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: wrapper | |
arguments: assembleRelease | |
- name: Get JSON | |
id: metadataJson | |
run: | | |
content=`cat app/build/outputs/apk/release/output-metadata.json` | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
echo "::set-output name=json::$content" | |
- name: Sign artifact | |
id: signArtifact | |
uses: ilharp/sign-android-release@v1 | |
with: | |
releaseDir: app/build/outputs/apk/release | |
keyAlias: ${{ secrets.KEYALIAS }} | |
signingKey: ${{ secrets.SIGNING_KEY }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
buildToolsVersion: 35.0.0-rc3 | |
- name: List files | |
run: ls app/build/outputs/apk/release | |
- name: Rename APK | |
run: mv app/build/outputs/apk/release/app-release-unsigned-signed.apk app/build/outputs/apk/release/app-release.apk | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Release Artifact | |
path: app/build/outputs/apk/release/app-release.apk | |
- name: Create new Release | |
id: create_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }} | |
prerelease: false | |
title: Rboard Patcher Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }} | |
files: | | |
app/build/outputs/apk/release/app-release.apk | |
app/build/outputs/apk/release/output-metadata.json | |
- name: Create new Release | |
id: create_latest_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest | |
prerelease: false | |
title: Rboard Patcher Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }} | |
files: | | |
app/build/outputs/apk/release/app-release.apk | |
app/build/outputs/apk/release/output-metadata.json |