Skip to content

Commit edad0e4

Browse files
SK-2967 add dry-run mode to shared release workflow (temporarily enabled)
Lets the public/beta release path be validated without publishing. Maven Central releases are immutable, so a real deploy cannot be used as a test. In dry-run: 'mvn verify' replaces 'mvn deploy' (the deploy plugin and central-publishing extension are never invoked at all) and the version-bump commit is built but not pushed. release.yml has dry-run: true TEMPORARILY for this verification - it is reverted in the next commit.
1 parent da6d446 commit edad0e4

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ jobs:
5555
tag: 'public'
5656
module: ${{ needs.resolve-release.outputs.module }}
5757
version: ${{ needs.resolve-release.outputs.version }}
58+
# TEMPORARY - pipeline verification only. MUST be removed before any
59+
# real release: while this is true, nothing is ever published.
60+
dry-run: true
5861
secrets:
5962
server-username: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_USERNAME }}
6063
server-password: ${{ secrets.CENTRAL_PUBLISHER_PORTAL_PASSWORD }}

‎.github/workflows/shared-build-and-deploy.yml‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ on:
3838
type: string
3939
default: ''
4040

41+
dry-run:
42+
description: >-
43+
Validate the release pipeline WITHOUT publishing anything.
44+
Everything still runs - tag parsing, version resolution, the pom
45+
bump, the full build, tests and GPG signing - but 'mvn verify'
46+
replaces 'mvn deploy' (so the deploy plugin never runs at all,
47+
rather than being asked politely to skip) and the version-bump
48+
commit is not pushed. Publishing to Maven Central is immutable,
49+
so this is the only safe way to exercise the public path.
50+
required: false
51+
type: boolean
52+
default: false
53+
4154
secrets:
4255
server-username:
4356
required: true
@@ -141,11 +154,19 @@ jobs:
141154
git add ${{ inputs.module }}/pom.xml
142155
if [[ "${{ inputs.tag }}" == "internal" ]]; then
143156
git commit -m "[AUTOMATED] Private Release ${{ steps.bump-version.outputs.base_version }}-dev-$(git rev-parse --short $GITHUB_SHA)"
144-
git push origin ${{ github.ref_name }} -f
157+
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
158+
echo "::notice::DRY RUN - not pushing the version-bump commit"
159+
else
160+
git push origin ${{ github.ref_name }} -f
161+
fi
145162
fi
146163
if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
147164
git commit -m "[AUTOMATED] Public Release - ${{ steps.bump-version.outputs.base_version }}"
148-
git push origin ${{ env.branch_name }}
165+
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
166+
echo "::notice::DRY RUN - not pushing the version-bump commit"
167+
else
168+
git push origin ${{ env.branch_name }}
169+
fi
149170
fi
150171
151172
- name: Create env
@@ -163,9 +184,21 @@ jobs:
163184
name: "credentials.json"
164185
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
165186

187+
# 'verify' rather than 'deploy' for a dry run: the deploy plugin (and
188+
# the central-publishing extension bound to it) is never invoked at
189+
# all, so there is no upload path to accidentally leave enabled.
190+
# Everything up to and including packaging, tests and GPG signing
191+
# still runs, so this exercises the same build the real release would.
166192
- name: Publish package
167193
run: |
168-
if [[ "${{ inputs.tag }}" == "internal" ]]; then
194+
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
195+
echo "::notice::DRY RUN - running 'verify' instead of 'deploy'; nothing will be published"
196+
if [[ "${{ inputs.tag }}" == "internal" ]]; then
197+
mvn --batch-mode -pl ${{ inputs.module }} -am verify -P jfrog -DskipTests
198+
else
199+
mvn --batch-mode -pl ${{ inputs.module }} -am verify -P ${{ inputs.profile }}
200+
fi
201+
elif [[ "${{ inputs.tag }}" == "internal" ]]; then
169202
mvn --batch-mode -pl ${{ inputs.module }} -am deploy -P jfrog -DskipTests
170203
elif [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
171204
mvn --batch-mode -pl ${{ inputs.module }} -am deploy -P ${{ inputs.profile }}

0 commit comments

Comments
 (0)