-
Notifications
You must be signed in to change notification settings - Fork 5
77 lines (69 loc) · 2.63 KB
/
release-please.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
# SPDX-FileCopyrightText: 2023 Alliander N.V.
#
# SPDX-License-Identifier: Apache-2.0
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release_please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: maven
package-name: compas-cim-mapping
target-branch: ${{ github.ref_name }}
- if: ${{ steps.release.outputs.release_created }}
name: Checkout
uses: actions/checkout@v4
- name: Cache Docker Register
if: ${{ steps.release.outputs.release_created }}
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
- name: Extract tag name
if: ${{ steps.release.outputs.release_created }}
id: extract_tagname
shell: bash
# Extract the tag name from the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 17
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
- name: Set up Docker Buildx
if: ${{ steps.release.outputs.release_created }}
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Create custom Maven Settings.xml
if: ${{ steps.release.outputs.release_created }}
uses: whelk-io/maven-settings-xml-action@v21
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Set version with Maven
if: ${{ steps.release.outputs.release_created }}
run: ./mvnw -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy with Maven to GitHub Packages and Docker Hub
if: ${{ steps.release.outputs.release_created }}
run: ./mvnw -B -s custom_maven_settings.xml -Pnative-image,release clean deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}