Skip to content

Publish SHOGun

Publish SHOGun #584

name: Publish SHOGun
on: workflow_dispatch
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
persist-credentials: false
- name: Set up Java 17
uses: actions/[email protected]
with:
java-version: 17
java-package: jdk
architecture: x64
- name: Restore cache
uses: actions/cache/restore@v3
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@v2
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@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Semantic release
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19
extra_plugins: |
@semantic-release/changelog@6
@terrestris/maven-semantic-release@2
@semantic-release/git@10
env:
GITHUB_TOKEN: ${{ secrets.GH_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: 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@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}