Skip to content

Merge pull request #24 from hossain-khan/fixes #2

Merge pull request #24 from hossain-khan/fixes

Merge pull request #24 from hossain-khan/fixes #2

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') }}
# 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
- 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: gradle publish