Skip to content

release: git fetch all tag with force to avoid "would clobber existin… #28

release: git fetch all tag with force to avoid "would clobber existin…

release: git fetch all tag with force to avoid "would clobber existin… #28

Workflow file for this run

name: Release to Maven Central
on:
push:
tags:
- '*'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: olegtarasov/get-tag@v2.1.3
id: tagName
with:
tagRegex: "(.*)"
- name: Set Release version env variable
run: |
echo "TAG_NAME=${{ steps.tagName.outputs.tag }}" >> $GITHUB_ENV
# if no tag exists, this is expected to fail
- name: Switch to git tag for release
run: |
git fetch --all --tags -f
git checkout tags/${{ env.TAG_NAME }} -b ${{ env.TAG_NAME }}-tmp-branch
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
server-id: sonatype-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
- name: Deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSWORD }}
run: |
./mvnw --batch-mode -Drevision=${{ env.TAG_NAME }} -P release clean deploy
- name: Create GHA release
uses: ncipollo/release-action@v1
with:
draft: true
artifacts: "sonar-pmd-plugin/target/*.jar"
bodyFile: CHANGELOG.md