Skip to content

Release And Publish

Release And Publish #2

Workflow file for this run

name: Release And Publish
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
# Required for axion-release to read git history
fetch-depth: 0
fetch-tags: true
- name: Determine version and create release
run: |
CURRENT_VERSION=$(./gradlew -q currentVersion)
echo "Current version: $CURRENT_VERSION"
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
echo "📋 Manual trigger - creating new release"
./gradlew markNextVersion
else
echo "🏷️ Tag trigger - version already determined by tag"
fi
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Build & stage all subprojects into root/build/staging-deploy
- name: Build & publish to local staging dir
run: |
./gradlew --no-daemon build publishAllPublicationsToLocalStagingRepository
# Map secrets -> JReleaser env vars
- name: Export JReleaser env vars
shell: bash
run: |
# Maven Central (Publisher API) creds
echo "JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_APP_USERNAME=${{ secrets.MC_USERNAME }}" >> $GITHUB_ENV
echo "JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_APP_PASSWORD=${{ secrets.MC_PASSWORD }}" >> $GITHUB_ENV
# GPG passphrase
echo "JRELEASER_GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}" >> $GITHUB_ENV
# Armored public key (preserve newlines)
echo "JRELEASER_GPG_PUBLIC_KEY<<EOF" >> $GITHUB_ENV
echo "${{ secrets.GPG_PUBLIC_KEY }}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Armored secret key (preserve newlines)
echo "JRELEASER_GPG_SECRET_KEY<<EOF" >> $GITHUB_ENV
echo "${{ secrets.GPG_SECRET_KEY }}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Use the built-in GitHub token for GitHub release
echo "JRELEASER_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
# sanity checks before the real release
- name: JReleaser dry run checks
run: ./gradlew --no-daemon jreleaserConfig jreleaserAssemble jreleaserChangelog
# Deploy to Maven Central (Publisher API) and create GitHub Release
# Use `jreleaserDeploy` if you ONLY want Central without creating a GH release.
- name: JReleaser full release
run: ./gradlew --no-daemon jreleaserFullRelease
# (Optional) Upload JReleaser output for debugging/audit
- name: Upload JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-output
path: |
build/jreleaser
out/jreleaser
if-no-files-found: ignore