Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/publish-github-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish to GitHub Packages

on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
workflow_dispatch: # Allows manual trigger from GitHub Actions UI

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21' # Match the project's Java version requirement (buildSrc needs Java 21)

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}

- name: Grant execute permission for Gradle wrapper
run: chmod +x ./gradlew

# CONFIGURATION REQUIRED:
# The following step publishes to GitHub Packages using credentials.
# No additional setup is needed as the project already has:
# 1. maven-publish plugin configured in lib/build.gradle.kts
# 2. GitHub Packages repository configuration with proper URL
# 3. Authentication using USERNAME and TOKEN environment variables
#
# The GITHUB_TOKEN is automatically provided by GitHub Actions and has
# the necessary permissions to publish packages to the same repository.
#
# If you need to publish to a different repository's packages, you would need to:
# 1. Create a Personal Access Token (PAT) with 'write:packages' permission
# 2. Add it as a repository secret (e.g., PACKAGES_TOKEN)
# 3. Use that secret instead of GITHUB_TOKEN
#
# The current version is hardcoded in lib/build.gradle.kts as "1.0.0"
# For dynamic versioning, consider:
# 1. Using the git tag (${GITHUB_REF#refs/tags/})
# 2. Reading version from gradle.properties
# 3. Using a gradle plugin like 'axion-release-plugin'
- name: Publish to GitHub Packages
env:
USERNAME: ${{ github.actor }} # GitHub username of the user/bot triggering the workflow
TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token with packages:write permission
run: ./gradlew publish