Skip to content

publish workflow

publish workflow #1

Workflow file for this run

name: Publish to GitHub Packages
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for flatten-maven-plugin to work with Git tags
- name: Set up JDK 24 and Maven
uses: actions/setup-java@v4
with:
java-version: "24"
distribution: "temurin"
cache: "maven"
- name: Extract version from Git tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Update version in pom.xml
run: |
sed -i "s/<version>.*<\/version>/<version>${{ steps.version.outputs.version }}<\/version>/" pom.xml
echo "Updated pom.xml version to ${{ steps.version.outputs.version }}"
- name: Build and Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn clean deploy -DskipTests