Skip to content

NetLicensing Client - Release #36

NetLicensing Client - Release

NetLicensing Client - Release #36

# 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 update & apt 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 "[email protected]"
- 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 }}