Skip to content

0.9.15 General modernisation #25

0.9.15 General modernisation

0.9.15 General modernisation #25

Workflow file for this run

# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
name: Maven Package
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'zulu'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
- name: Import GPG key
run: |
# Write key to file to handle multiline content properly
cat <<'EOF' > "$RUNNER_TEMP/private-key.asc"
${{ secrets.OSSRH_GPG_SECRET_KEY }}
EOF
# Check file info (size won't be masked)
echo "Key file size: $(wc -c < "$RUNNER_TEMP/private-key.asc") bytes"
echo "Key file lines: $(wc -l < "$RUNNER_TEMP/private-key.asc") lines"
# Check if it looks like a PGP key
if grep -q "BEGIN PGP PRIVATE KEY BLOCK" "$RUNNER_TEMP/private-key.asc"; then
echo "✓ File contains PGP key header"
else
echo "✗ File does NOT contain PGP key header!"
echo "Your OSSRH_GPG_SECRET_KEY secret is not in the correct format."
echo "It should start with: -----BEGIN PGP PRIVATE KEY BLOCK-----"
exit 1
fi
# Import the key
gpg --batch --import "$RUNNER_TEMP/private-key.asc"
# List imported keys
echo "Successfully imported keys:"
gpg --list-secret-keys --keyid-format LONG
# Clean up
rm "$RUNNER_TEMP/private-key.asc"
- name: Publish package
run: mvn --no-transfer-progress --batch-mode -DperformRelease=true clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}