.github/workflows/android.yml
name: Android CI
on: [push,pull_request]
jobs:
build:
name: Android Compilation Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Make Gradle executable
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Generate Local Properties file
env:
GPG_SIGN_KEY: ${{ secrets.GPG_SIGNING_KEY }}
run: echo $GPG_SIGN_KEY | base64 --decode > ./local.properties
- name: Local publishing test to ensure working
run: ./gradlew clean build publishReleasePublicationToMavenLocal
env:
GPG_SIGN_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
mavenCentral:
name: Release to Maven Central
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Make Gradle executable
run: chmod +x gradlew
- name: Generate Local Properties file
env:
GPG_SIGN_KEY: ${{ secrets.GPG_SIGNING_KEY }}
run: echo $GPG_SIGN_KEY | base64 --decode > ./local.properties
- name: Generate artifact, publish release and upload to Maven Central and GitHub Packages
run: ./gradlew clean build publish
env:
OSSRH_PASSWORD: ${{ secrets.OSSRHPASSWORD }}
OSSRH_USER: ${{ secrets.OSSRHUSER }}
GPG_SIGN_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- name: Move Library AAR file to main folder
run: mv ./\appupdater/build/outputs/aar/appupdater-release.aar ./appupdater-release.aar
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GH Actions
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
generate_release_notes: true
draft: false
prerelease: false
files: appupdater-release.aar
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: master
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Finish Up
run: echo Upload successful. Maintainers can proceed onto https://s01.oss.sonatype.org to release the artifacts when capable