Issue #217: Fix CI triggers again #4
Workflow file for this run
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
name: Publish SNAPSHOT to TBD Artifactory | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to publish. For example "1.0.0-SNAPSHOT". If not supplied, will default to version specified in the POM.' | |
required: false | |
default: '0.0.0-SNAPSHOT' | |
push: | |
branches: | |
- issue-217/maven-build | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# https://cashapp.github.io/hermit/usage/ci/ | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# Adapted from: https://gist.github.com/sualeh/ae78dc16123899d7942bc38baba5203c | |
- name: Install gpg secret key | |
run: | | |
# Install gpg secret key | |
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg --batch --import | |
# Verify gpg secret key | |
gpg --list-secret-keys --keyid-format LONG | |
# This will set versions, git tag, and publish to TBD Artifactory. Does not release to Maven Central. | |
- name: Staging - Prepare and Publish Release to TBD Artifactory | |
run: | | |
if [ -n "${{ github.event.inputs.version }}" ]; then | |
mvn \ | |
deploy | |
--batch-mode \ | |
--settings .maven_settings.xml \ | |
-Dversion=${{ github.event.inputs.version }} \ | |
-Dgpg.passphrase=${{ secrets.GPG_SECRET_PASSPHRASE }} | |
else | |
mvn \ | |
deploy | |
--batch-mode \ | |
--settings .maven_settings.xml \ | |
-Dgpg.passphrase=${{ secrets.GPG_SECRET_PASSPHRASE }} | |
fi | |
env: | |
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} |