-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnetlicensing-client-release.yml
More file actions
87 lines (77 loc) · 2.79 KB
/
netlicensing-client-release.yml
File metadata and controls
87 lines (77 loc) · 2.79 KB
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
# This workflow will release the project
name: NetLicensing Client - Release
on:
workflow_dispatch:
inputs:
release-version:
required: true
description: The release version X.Y.Z
jobs:
release:
name: Release ${{ github.event.inputs.release-version }} / Java ${{ matrix.java-version }}
runs-on: self-hosted
env:
RELEASE_WORK_DIR: checkout-for-release
container: maven:3-eclipse-temurin-17
strategy:
fail-fast: false
matrix:
java-version: [11, 17]
include:
- java-version: 11
jdk-suffix:
- java-version: 17
jdk-suffix: -jdk17
steps:
- name: Install required tooling
# Specific to maven:3-amazoncorretto-17-al2023 image
# run: yum install -y --allowerasing git gnupg2
# Specific to maven:3-eclipse-temurin-17 image
run: |
apt-get update
apt-get install -y ssh gnupg2
- name: Checkout the sources
uses: actions/checkout@v4
with:
path: ${{ env.RELEASE_WORK_DIR }}
ssh-key: '${{ secrets.REPO_SSH_KEY }}'
# Relies on actions/checkout with 'ssh-key' parameter.
- name: Prepare git config
run: |
cd $RELEASE_WORK_DIR
git config user.name "GitHub Actions Bot"
git config user.email "netlicensing@labs64.com"
- name: Prepare maven settings.xml
run: |
mkdir -p ~/.m2
cat << EOF >~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.OSS_USER }}</username>
<password>${{ secrets.OSS_PASS }}</password>
</server>
</servers>
</settings>
EOF
- name: Import GPG key
run: echo "${{ secrets.GPG_KEY }}" | base64 -d | gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_KEY_PASS }}" --import
- name: Calculate branch suffix
run: |
BRANCH_SUFFIX=${{ matrix.jdk-suffix }}
echo "Branch suffix: '$BRANCH_SUFFIX'"
echo "BRANCH_SUFFIX=$BRANCH_SUFFIX" >> "$GITHUB_ENV"
- name: Release to Maven Central staging
run: |
cd $RELEASE_WORK_DIR
mvn -s ~/.m2/settings.xml -B \
clean deploy scm:tag \
-P release \
-Drevision=${{ github.event.inputs.release-version }} \
-Dsha1=$BRANCH_SUFFIX \
-Dchangelist= \
-Djava.version=${{ matrix.java-version }} \
-Dmessage="Release ${{ github.event.inputs.release-version }}" \
-Dgpg.passphrase=${{ secrets.GPG_KEY_PASS }}