add trigger on tags #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
concurrency: | |
group: ${{ github.workflow }} @ ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ "*" ] | |
tags: [v*] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B test --file pom.xml | |
publish: | |
name: Publish Artifacts | |
needs: [ build ] | |
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java (temurin@17) | |
id: setup-java-temurin-17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
# Store the version, stripping any v-prefix | |
- name: Write release version | |
run: | | |
VERSION=${GITHUB_REF_NAME#v} | |
echo Version: $VERSION | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: set version | |
run: | | |
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false | |
- name: Release Maven package | |
uses: WasiqB/maven-publish-action@v2 | |
with: | |
server_id: sonatype | |
maven_profiles: release | |
gpg_private_key: ${{ secrets.PGP_SECRET }} | |
gpg_passphrase: ${{ secrets.PGP_PASSPHRASE }} | |
server_username: ${{ secrets.SONATYPE_USERNAME }} | |
server_password: ${{ secrets.SONATYPE_PASSWORD }} |