Add Info Docker Images zur README #67
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: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Set up api-telematik | |
run: | | |
mkdir api/ && cd api/ | |
git config --global user.email "[email protected]" | |
git config --global user.name "Release Bot" | |
git clone https://github.com/gematik/api-telematik.git | |
- name: Extract release notes | |
id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v1 | |
- name: Build with Maven | |
id: build_maven | |
run: | | |
mvn -B package --file pom.xml | |
VERSION=$(mvn --non-recursive help:evaluate -Dexpression=project.version -q -DforceStdout | grep -v '\[.*') | |
echo "::set-output name=version::$VERSION" | |
- uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: OpenKIM-${{ steps.build_maven.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish new version | |
if: steps.checkTag.outputs.exists == 'false' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_name: sberg-net/openkim | |
# Personal access tokens (classic): `repo, user, admin:repo_hook` | |
#repo_token: ${{ secrets.ACCESS_TOKEN }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/openkim-${{ steps.build_maven.outputs.version }}.jar | |
tag: OpenKIM-${{ steps.build_maven.outputs.version }} | |
overwrite: false | |
body: ${{ steps.extract-release-notes.outputs.release_notes }} | |
- name: Docker meta | |
if: steps.checkTag.outputs.exists == 'false' | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
# ghcr.io/sbergit/openkim | |
images: | | |
sbergit/openkim | |
# generate Docker tags based on the following events/attributes | |
# type=raw,value=latest,enable={{is_default_branch}} | |
# type=semver,pattern={{major}}.{{minor}} | |
# type=semver,pattern={{major}} | |
tags: | | |
type=raw,value=latest | |
type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.build_maven.outputs.version }} | |
type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.build_maven.outputs.version }} | |
type=sha | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
#- name: Set up QEMU | |
# uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: steps.checkTag.outputs.exists == 'false' | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Inspect builder | |
if: steps.checkTag.outputs.exists == 'false' | |
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 | |
if: steps.checkTag.outputs.exists == 'false' | |
uses: docker/login-action@v1 | |
with: | |
username: sbergit | |
password: ${{ secrets.DOCKER_HUB }} | |
# - name: Login to GitHub Container Registry | |
# if: steps.checkTag.outputs.exists == 'false' | |
# uses: docker/login-action@v1 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
if: steps.checkTag.outputs.exists == 'false' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64 | |
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 |