Merge pull request #256 from redlink-gmbh/dependabot/maven/org.sonars… #133
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, Test & Publish | |
on: | |
push: | |
branches: | |
- "main" | |
- "maintenance/*" | |
tags: | |
- "redlink-utils-v*" | |
jobs: | |
version: | |
name: Determine Version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout | |
with: | |
fetch-depth: 2 | |
- name: Set up Java/Maven | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Detect Version | |
id: version | |
run: ./mvnw -B -q -N exec:exec -Dexec.executable=echo -Dexec.args='version=${project.version}' >>"$GITHUB_OUTPUT" | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Java/Maven | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Compile & Test | |
run: ./mvnw -V -B --no-transfer-progress | |
clean package verify | |
-Psonarcloud | |
-Dsonar.projectKey=io.redlink.utils:redlink-utils | |
-Dsonar.skip=${{ github.actor == 'dependabot[bot]' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: '**/TEST-*.xml' | |
deploy: | |
name: Publish | |
needs: | |
- version | |
- build | |
runs-on: ubuntu-latest | |
if: github.repository == 'redlink-gmbh/redlink-utils' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Java/Maven | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Publish Packages | |
run: ./mvnw -B --no-transfer-progress | |
package javadoc:aggregate-jar deploy | |
-Prelease | |
-Dquick | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |