Remove old Gitlab and Azure Devops summary comments on new decoration #1036
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: | |
- '**' | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- '**' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
prep: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.init.outputs.version }} | |
release: ${{ steps.init.outputs.release }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Init | |
id: init | |
run: | | |
VERSION=$(grep "version" gradle.properties | cut -d'=' -f2) | |
echo ::set-output name=version::${VERSION} | |
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
echo ::set-output name=release::true | |
else | |
echo ::set-output name=release::false | |
fi | |
snapshot: | |
needs: prep | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
java: | |
- 17 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
java-package: jdk | |
distribution: 'zulu' | |
- | |
name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- | |
name: Build | |
run: | | |
./gradlew clean build | |
- | |
name: Archive artifact | |
if: success() && matrix.java == '17' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: snapshot | |
path: build/libs/*.jar | |
release: | |
needs: prep | |
if: github.event_name != 'pull_request' && needs.prep.outputs.release == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: 'zulu' | |
- | |
name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- | |
name: Set up Git | |
run: | | |
git config user.name GitHub | |
git config user.email noreply@github.com | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Release | |
if: success() | |
run: | | |
./gradlew clean release \ | |
-Prelease.useAutomaticVersion=true \ | |
-Prelease.releaseVersion=${{ needs.prep.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Archive artifact | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release | |
path: build/libs/*.jar | |
- | |
name: GitHub Release | |
uses: softprops/action-gh-release@v2 | |
if: success() | |
with: | |
name: ${{ needs.prep.outputs.version }} | |
tag_name: ${{ needs.prep.outputs.version }} | |
draft: true | |
files: | | |
build/libs/*.jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
sonar: | |
needs: prep | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: 'zulu' | |
- | |
name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- | |
name: Test and Sonar | |
if: ${{ env.SONAR_TOKEN != null }} | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
./gradlew test sonar \ | |
-Dsonar.gradle.skipCompile=true \ | |
-Dsonar.pullrequest.provider=github \ | |
-Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.organization=${SONAR_ORG_KEY} \ | |
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
-Dsonar.pullrequest.key=${{ github.event.number }} \ | |
-Dsonar.pullrequest.base=${{ github.base_ref }} | |
elif [ "${{ needs.prep.outputs.release }}" = 'true' ]; then | |
./gradlew test sonar \ | |
-Dsonar.gradle.skipCompile=true \ | |
-Dsonar.pullrequest.provider=github \ | |
-Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.organization=${SONAR_ORG_KEY} \ | |
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
-Dsonar.projectVersion=${{ needs.prep.outputs.version }} | |
else | |
./gradlew test sonar \ | |
-Dsonar.gradle.skipCompile=true \ | |
-Dsonar.pullrequest.provider=github \ | |
-Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.organization=${SONAR_ORG_KEY} \ | |
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
-Dsonar.branch.name=${GITHUB_REF##*/} | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_ORG_KEY: ${{ secrets.SONAR_ORG_KEY }} | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} |