Merge pull request #57 from cvzi/renovate/gradle-8.x #157
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 | |
steps: | |
- 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/wrapper-validation-action@v3 | |
- name: 🔐 Decrypt keystore | |
if: ${{ github.ref_type == 'tag' }} | |
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 | |
if: ${{ github.ref_type != 'tag' }} | |
run: | | |
./gradlew build | |
- name: 🎁 Build release | |
if: ${{ github.ref_type == 'tag' }} | |
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+\K[0-9]+" app/build.gradle) | |
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: 🎉 Publish Github release | |
if: ${{ github.ref_type == 'tag' }} | |
uses: softprops/[email protected] | |
with: | |
files: wallpaperexport_gh_${{ steps.version.outputs.versionCode }}.apk | |
body_path: fastlane/metadata/android/en-US/changelogs/${{ steps.version.outputs.versionCode }}.txt |