Merge pull request #8 from sberg-net/fix-spring6-secure-config #75
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: Release | |
on: | |
push: | |
branches: [ main ] | |
tags-ignore: | |
- '*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Extract data from pom.xml | |
id: pom-data | |
uses: andreacomo/maven-gav-extractor@v2 | |
- name: Get Changelog Entry based on pom.xml version | |
id: changelog_for_pom_version | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
version: ${{ steps.pom-data.outputs.version }} | |
validation_level: error | |
validation_depth: 5 | |
- name: check tag on version | |
uses: mukunku/tag-exists-action@v1.1.0 | |
id: tag-for-pom-version | |
with: | |
tag: OpenKIM-${{ steps.pom-data.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: cancel action on tag exist | |
if: steps.tag-for-pom-version.outputs.exists == 'true' | |
run: | | |
echo "::error::Tag for version ${{ steps.pom-data.outputs.version }} already exist." | |
exit 1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Set up api-telematik | |
run: | | |
mkdir api/ && cd api/ | |
git config --global user.email "no_reply@sberg.net" | |
git config --global user.name "Release Bot" | |
git clone https://github.com/gematik/api-telematik.git | |
- name: Build with Maven | |
id: build_maven | |
run: | | |
mvn -B package --file pom.xml | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_HUB_USER }}/openkim | |
tags: | | |
type=raw,value=latest | |
type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.pom-data.outputs.version }} | |
#type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.pom-data.outputs.version }} | |
#type=sha | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Inspect builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
echo "Tags: ${{ steps.meta.outputs.tags }}" | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Publish new version | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/openkim-${{ steps.pom-data.outputs.version }}.jar | |
tag: OpenKIM-${{ steps.pom-data.outputs.version }} | |
overwrite: false | |
body: ${{ steps.changelog_for_pom_version.outputs.changes }} |