Publish SHOGun #598
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: Publish SHOGun | |
on: workflow_dispatch | |
jobs: | |
publish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is needed for correctly determing next release with semantic release | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Set up Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
architecture: x64 | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Create maven settings.xml with credentials | |
uses: whelk-io/maven-settings-xml-action@v22 | |
with: | |
servers: | | |
[ | |
{ "id": "nexus.terrestris.de", "username": "${{ secrets.NEXUS_USER }}", "password": "${{ secrets.NEXUS_PASSWORD }}" }, | |
{ "id": "docker-public.terrestris.de", "username": "${{ secrets.NEXUS_DOCKER_USER }}", "password": "${{ secrets.NEXUS_DOCKER_PASSWORD }}" }, | |
{ "id": "terrestris-nexus", "username": "${{ secrets.NEXUS_USER }}", "password": "${{ secrets.NEXUS_PASSWORD }}" }, | |
{ "id": "terrestris-nexus-snapshots", "username": "${{ secrets.NEXUS_USER }}", "password": "${{ secrets.NEXUS_PASSWORD }}" } | |
] | |
- name: Install dependencies | |
run: mvn compile --batch-mode | |
- name: Save cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
- name: Semantic release | |
id: semantic | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
semantic_version: 23 | |
extra_plugins: | | |
@semantic-release/changelog@6 | |
@terrestris/maven-semantic-release@2 | |
@semantic-release/git@10 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Scan for unit tests | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: mvn clean verify sonar:sonar --batch-mode -Dsonar.projectKey=SHOGun -Dsonar.login="${{ secrets.SONARQUBE_TOKEN }}" -Preporting | |
- name: Refresh SonarQube | |
if: ${{ github.actor != 'dependabot[bot]' }} && steps.semantic.outputs.new_release_published == 'true' | |
run: mvn compile sonar:sonar --batch-mode -Dsonar.projectKey=SHOGun -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} -Dsonar.login="${{ secrets.SONARQUBE_TOKEN }}" | |
- name: Save cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |