Bump junit from 5.11.2 to 5.11.3 #882
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: Build | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
concurrency: | |
# On master, we don't want any jobs cancelled so the sha is used to name the group | |
# On PR branches, we cancel the job if new commits are pushed | |
# More info: https://stackoverflow.com/a/68422069/253468 | |
group: ${{ (github.ref == 'refs/heads/master') && format('{0}-{1}', github.workflow_ref, github.sha) || format('{0}-{1}', github.workflow_ref, github.head_ref) }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: ${{ github.repository == 'Breus/json-masker' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
checks: write # for publishing test results and annotations | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- id: get-snapshot-version | |
name: Generate snapshot version | |
shell: bash | |
run: | | |
# expects git tag to be in format 'v0.1.0' or 'v0.1.0-rc1' | |
version=$(git describe --tag --abbrev=0 | cut -c 2-) | |
regex="^([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$" | |
if [[ $version =~ $regex ]]; then | |
major="${BASH_REMATCH[1]}" | |
minor="${BASH_REMATCH[2]}" | |
patch="${BASH_REMATCH[3]}" | |
pre_release="${BASH_REMATCH[4]:-}" | |
# increment patch version of the latest release to create new snapshot version | |
# when pre-release - continue snapshots of the same version | |
# v0.1.0 -> 0.1.0-SNAPSHOT | |
# v0.1.0-rc -> 0.1.0-SNAPSHOT | |
if [[ -z $pre_release ]]; then | |
patch=$(($patch + 1)) | |
fi | |
snapshot_version="${major}.${minor}.${patch}" | |
if ! [[ $snapshot_version =~ $regex ]]; then | |
echo "SNAPSHOT version $snapshot_version is not a valid SemVer" | |
exit 1 | |
fi | |
echo "${snapshot_version}-SNAPSHOT" | |
echo "snapshot-version=${snapshot_version}-SNAPSHOT" >> $GITHUB_OUTPUT | |
else | |
echo "Version $version is not a valid SemVer" | |
exit 1 | |
fi | |
- name: Build | |
run: | | |
./gradlew \ | |
-Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} \ | |
build | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: ${{ !cancelled() }} # always run even if the previous step fails | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
- name: Sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }} | |
# skip on the forked repositories that don't have access to secrets | |
if: ${{ !cancelled() && env.SONAR_TOKEN != '' }} | |
run: | | |
./gradlew \ | |
-Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} \ | |
sonar -Dsonar.gradle.skipCompile=true | |
- name: Upload SNAPSHOT artifacts to Sonatype | |
id: upload_snapshot_artifacts | |
if: ${{ github.ref == 'refs/heads/master' }} | |
env: | |
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }} | |
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }} | |
GPG_PRIV_KEY: ${{ secrets.GPG_PRIV_KEY }} | |
GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }} | |
run: | | |
./gradlew \ | |
-Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} \ | |
publishAllPublicationsToSonatypeRepository closeSonatypeStagingRepository |