Merge pull request #72 from cvzi/renovate/gradle-8.x #200
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: 🔨 Gradle Build CI | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- 'fastlane/**' | |
- '*.md' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
attestations: write | |
contents: write | |
steps: | |
- name: ⬇️ Checkout repository | |
uses: actions/checkout@v4 | |
- name: ♨️ JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
check-latest: true | |
- name: ❎ Add exec permission | |
run: chmod +x gradlew | |
- name: 🕵️ Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: 🔐 Decrypt keystore | |
run: | | |
echo "${{secrets.KEYSTORE}}" > github_release.jks.asc | |
gpg -d --passphrase "${{secrets.KEYSTORE_FILE_PASSWORD}}" --batch --output github_release.jks github_release.jks.asc | |
- name: 🎁 Build | |
run: | | |
./gradlew build | |
- name: 🎁 Build release | |
run: | | |
./gradlew assembleRelease \ | |
--project-prop keystore=../github_release.jks \ | |
--project-prop keystorepassword=${{secrets.KEYSTORE_PASSWORD}} \ | |
--project-prop keystorealias=${{secrets.KEYSTORE_KEY_ALIAS}} \ | |
--project-prop keystorekeypassword=${{secrets.KEYSTORE_KEY_PASSWORD}} | |
- name: 💬 Upload Lint report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lint-results.html | |
path: app/build/reports/lint-results*.html | |
- name: 🏷️ Extract versionCode | |
if: ${{ github.ref_type == 'tag' }} | |
id: version | |
run: | | |
versionCode=$(grep -Po "versionCode\s*=\s*\K[0-9]+" app/build.gradle.kts) | |
echo "versionCode: $versionCode" | |
echo "versionCode=$versionCode" >> $GITHUB_OUTPUT | |
- name: 🔖 Rename apk file | |
if: ${{ github.ref_type == 'tag' }} | |
env: | |
VERSION: ${{ github.ref_name }} | |
run: | | |
mv app/build/outputs/apk/release/app-release.apk wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk | |
- name: 📜 Attest | |
if: ${{ github.ref_type == 'tag' }} | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk' | |
- name: 🎉 Publish Github release | |
if: ${{ github.ref_type == 'tag' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk | |
body_path: fastlane/metadata/android/en-US/changelogs/${{ steps.version.outputs.versionCode }}.txt |