-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (97 loc) · 3.54 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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 }}