NetLicensing Client - Release #26
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
# 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 | |
container: maven:3-amazoncorretto-17-al2023 | |
strategy: | |
fail-fast: false | |
matrix: | |
java-version: [11, 17] | |
include: | |
- java-version: 11 | |
jdk-suffix: | |
- java-version: 17 | |
jdk-suffix: -jdk17 | |
steps: | |
# Specific to the maven:3-amazoncorretto-17-al2023 image | |
- name: Install required tooling | |
run: yum install -y --allowerasing git gnupg2 | |
- name: Checkout the sources | |
uses: actions/checkout@v4 | |
with: | |
path: 'nlic-client-release' | |
ssh-key: '${{ secrets.REPO_SSH_KEY }}' | |
# Relies on actions/checkout with 'ssh-key' parameter. | |
- name: Prepare git config | |
run: | | |
cd nlic-client-release | |
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 "pinentry-program /usr/bin/pinentry" >>~/.gnupg/gpg-agent.conf | |
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 nlic-client-release | |
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 }} |