Reusable GitHub Actions workflows shared by the AC-Clash plugin projects. Each plugin repo calls one workflow here instead of keeping its own copy, so a fix to the release process only has to be made once.
Builds a Gradle project and publishes a GitHub release whenever its version number changes.
On every push it:
- Reads the version from
build.gradle.kts.-SNAPSHOTversions are skipped. - Compares it with the latest tag. If the version hasn't changed, the run stops here, so ordinary commits never create releases.
- Picks the JDK from the project's
languageVersionsetting and installs that version of Amazon Corretto. - Builds the JAR with
./gradlew build. - On
main/masteronly: tags the commitv<version>, creates a GitHub release with notes generated from the commit messages since the last tag, and uploads the built JAR as a release asset. - Emails the author a link to the new release, if the
passwdsecret is set.
Add a caller workflow to the project, for example .github/workflows/release.yml:
name: Release
on:
push:
branches: ['**']
tags-ignore: ['*']
jobs:
release:
permissions:
contents: write
uses: AC-Clash/workflows/.github/workflows/java-gradle-release.yml@main
secrets:
token: ${{ secrets.TOKEN }}
passwd: ${{ secrets.PASSWD }} # optional| Secret | Purpose |
|---|---|
token |
GitHub token with contents: write, used to create the release and upload the JAR |
passwd |
Optional. App password for the SMTP account that sends the release email. If it is not set, the email step is skipped. |
- Gradle Kotlin DSL (
build.gradle.kts) with a quotedversion = "..." - A Java toolchain set with
languageVersion.set(JavaLanguageVersion.of(N)) - The Gradle wrapper (
gradlew) committed to the repo - The built JAR in
build/libs/. JARs ending indev.jarordev-all.jarare ignored.