Skip to content

Release SDK

Release SDK #9

Workflow file for this run

name: Release SDK
on:
workflow_dispatch:
inputs:
dry-run:
description: 'If true, simulate the commands without executing them'
required: false
default: 'true'
jobs:
read-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Extract version from pom.xml
id: get_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Show extracted version
run: echo "Current version is ${{ steps.get_version.outputs.version }}"
- name: Extract release version
id: extract_version
run: |
RAW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_VERSION=${RAW_VERSION/-SNAPSHOT/}
echo "RELEASE_VERSION=$RELEASE_VERSION"
echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: Set release version in pom.xml (temporary)
run: |
RELEASE_VERSION=${{ steps.extract_version.outputs.release-version }}
echo "Temporarily setting version to $RELEASE_VERSION"
mvn versions:set -DnewVersion=$RELEASE_VERSION
mvn versions:commit
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import
mkdir -p ~/.gnupg
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent
- name: Sign artifacts (always runs)
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "Running: mvn verify -Psign-release"
mvn verify -Psign-release
- name: Verify signed artifacts
run: |
VERSION=${{ steps.extract_version.outputs.release-version }}
ARTIFACTS_DIR=target
FILES=(
"aco-java-sdk-${VERSION}.jar"
"aco-java-sdk-${VERSION}-sources.jar"
"aco-java-sdk-${VERSION}-javadoc.jar"
)
for file in "${FILES[@]}"; do
if [[ -f "$ARTIFACTS_DIR/$file" && -f "$ARTIFACTS_DIR/$file.asc" ]]; then
echo "✅ Signed: $file and $file.asc"
else
echo "❌ Missing signature for $file"
exit 1
fi
done