Skip to content

Commit a0817d8

Browse files
denglimingclaude
andcommitted
Release workflow: tolerant GPG key import and manual version input
The GPG secrets were set after the 2.0.4 release, so this step had never run. The import now accepts an armored key with real or escaped newlines or a base64 blob, and workflow_dispatch takes the version to publish. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent afd916a commit a0817d8

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎.github/workflows/version-and-release.yml‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: Version to publish (e.g. 3.0.0); the poms are set to it before deploying
10+
required: true
711

812
jobs:
913
build:
@@ -26,13 +30,19 @@ jobs:
2630
run: |
2731
mvn --no-transfer-progress \
2832
--batch-mode \
29-
versions:set -DnewVersion=${{ github.event.release.tag_name }}
30-
if: ${{ github.event.release.tag_name }}
33+
versions:set -DnewVersion=${{ github.event.inputs.version || github.event.release.tag_name }} -DprocessAllModules
3134
3235
- name: Install GPG key
36+
# accepts the armored key with real newlines, with escaped "\n", or base64 encoded
3337
run: |
34-
cat <(echo -e "${{ secrets.GPG_SECRET }}") | gpg --batch --import
38+
printf '%s' "$GPG_SECRET" > "$RUNNER_TEMP/gpg.key"
39+
gpg --batch --import "$RUNNER_TEMP/gpg.key" 2>/dev/null \
40+
|| printf '%b' "$GPG_SECRET" | gpg --batch --import 2>/dev/null \
41+
|| base64 -d "$RUNNER_TEMP/gpg.key" | gpg --batch --import
42+
rm -f "$RUNNER_TEMP/gpg.key"
3543
gpg --list-secret-keys --keyid-format LONG
44+
env:
45+
GPG_SECRET: ${{ secrets.GPG_SECRET }}
3646

3747
- name: Publish to Maven
3848
run: |

0 commit comments

Comments
 (0)