Skip to content

v0.17.47

v0.17.47 #135

Workflow file for this run

name: Release
on:
release:
types:
- published
jobs:
sonar:
if: "!contains(github.event.head_commit.message, '[version bump]')"
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
cache: 'maven'
- name: Build and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify sonar:sonar -Dgpg.skip
publish:
if: "!contains(github.event.head_commit.message, '[version bump]')"
runs-on: ubuntu-latest
needs: [ sonar ]
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
cache: 'maven'
server-id: 'central'
server-username: SONATYPE_USERNAME
server-password: SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Get version from POM without SNAPSHOT
run: |
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
- name: Setup release version
run: |
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH))"
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Update POM Version
run: |
echo "New version is: $NEW_VERSION"
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false -B
- name: Build and Publish
run: |
mvn \
--no-transfer-progress \
--batch-mode \
-DskipTests=true \
-Psonatype-deploy \
deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Commit files
run: |
git commit -m "[version bump]" -a
git tag -a release-$NEW_VERSION -m "[version bump]"
git push origin release-$NEW_VERSION
bump:
if: "!contains(github.event.head_commit.message, '[version bump]')"
runs-on: ubuntu-latest
needs: [ publish ]
steps:
- name: Checkout Branch
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
cache: 'maven'
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Get version from POM without SNAPSHOT
run: |
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
- name: Bump And Update POM Version to new Development version
run: |
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))-SNAPSHOT"
echo "New development version is: $NEW_VERSION"
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false
- name: Commit files
run: |
git commit -m "[version bump] new dev version" -a
- name: Push Development Version to Branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{github.event.release.target_commitish || 'main'}}