Skip to content

Commit 5518819

Browse files
committed
ci: fix release-commit threading and remove dead changelog workflow
Address PR review (MarketDataDev03): 1. Chained publish built github.sha (the launch commit), not the released ref. In workflow_call, github.sha is inherited from the caller's launch ref, and publish.yml checked out with no ref:. If tag-and-release was launched from a branch other than inputs.ref, the tag/Release pointed at inputs.ref but the immutable Maven Central jar was built from the launch commit. Fix: add a `ref` input to publish.yml used in both the guard (head_sha) and checkout; tag-and-release resolves inputs.ref to a concrete SHA, tags at that SHA, and passes it to publish-central. 2. update-changelog.yml (on: release) never fired: the release is cut with GITHUB_TOKEN, and GITHUB_TOKEN-created events don't trigger workflows — the same rule that motivated workflow_call for publish. It was also redundant: our process finalizes the CHANGELOG (dated section) before the tag, which the notes-extraction step requires. Fix: remove the workflow.
1 parent 596266b commit 5518819

3 files changed

Lines changed: 33 additions & 36 deletions

File tree

.github/workflows/publish.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
description: "Version to publish (e.g. 1.0.0, without the 'v')"
99
required: true
1010
type: string
11+
ref:
12+
description: "Commit SHA to build & publish from (defaults to the launch commit)"
13+
required: false
14+
default: ''
15+
type: string
1116
release:
1217
description: "Publish and release. Off = upload to the Portal and stop at VALIDATED for manual review."
1318
required: true
@@ -20,6 +25,11 @@ on:
2025
description: "Version to publish (e.g. 1.0.0, without the 'v')"
2126
required: true
2227
type: string
28+
ref:
29+
description: "Commit SHA to build & publish from (defaults to the launch commit)"
30+
required: false
31+
default: ''
32+
type: string
2333
release:
2434
description: "Publish and release. Off = upload to the Portal and stop at VALIDATED."
2535
required: false
@@ -36,13 +46,17 @@ jobs:
3646
- name: Check latest main.yml conclusion
3747
env:
3848
GH_TOKEN: ${{ github.token }}
49+
REPO: ${{ github.repository }}
50+
# Build/guard against the explicit commit when given (chained path);
51+
# otherwise the commit the workflow was launched from.
52+
SHA: ${{ inputs.ref || github.sha }}
3953
run: |
4054
conclusion=$(gh api \
41-
"repos/${{ github.repository }}/actions/workflows/main.yml/runs?head_sha=${{ github.sha }}&status=completed" \
55+
"repos/${REPO}/actions/workflows/main.yml/runs?head_sha=${SHA}&status=completed" \
4256
--jq '.workflow_runs[0].conclusion // "missing"')
43-
echo "main.yml conclusion for ${{ github.sha }}: $conclusion"
57+
echo "main.yml conclusion for ${SHA}: $conclusion"
4458
if [ "$conclusion" != "success" ]; then
45-
echo "::error::main.yml is not green for ${{ github.sha }} (got: $conclusion). Run publish from a commit on main whose CI passed."
59+
echo "::error::main.yml is not green for ${SHA} (got: $conclusion). Run publish from a commit on main whose CI passed."
4660
exit 1
4761
fi
4862
@@ -62,6 +76,9 @@ jobs:
6276
steps:
6377
- name: Checkout
6478
uses: actions/checkout@v4
79+
with:
80+
# Build from the explicit commit when chained; else the launch commit.
81+
ref: ${{ inputs.ref || github.sha }}
6582

6683
- name: Set up JDK 17
6784
uses: actions/setup-java@v4

.github/workflows/tag-and-release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,22 @@ jobs:
108108
name: Tag and GitHub Release
109109
runs-on: ubuntu-latest
110110
needs: gate
111+
outputs:
112+
sha: ${{ steps.resolve.outputs.sha }}
111113
steps:
112114
- name: Checkout code
113115
uses: actions/checkout@v4
114116
with:
115117
fetch-depth: 0
116118
ref: ${{ inputs.ref }}
117119

120+
# Resolve inputs.ref to a concrete commit SHA so the tag, the GitHub
121+
# Release, and the chained Maven Central build all point at the SAME
122+
# commit — even if the workflow was launched from a different branch.
123+
- name: Resolve commit SHA
124+
id: resolve
125+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
126+
118127
- name: Verify tag does not already exist
119128
shell: bash
120129
env:
@@ -154,7 +163,7 @@ jobs:
154163
env:
155164
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156165
VERSION: ${{ inputs.version }}
157-
TARGET_REF: ${{ inputs.ref }}
166+
TARGET_REF: ${{ steps.resolve.outputs.sha }}
158167
IS_PRERELEASE: ${{ inputs.prerelease }}
159168
shell: bash
160169
run: |
@@ -186,5 +195,8 @@ jobs:
186195
uses: ./.github/workflows/publish.yml
187196
with:
188197
version: ${{ inputs.version }}
198+
# Build & publish the exact commit that was tagged/released, not the
199+
# workflow's launch commit (github.sha) — Maven Central is immutable.
200+
ref: ${{ needs.release.outputs.sha }}
189201
release: true
190202
secrets: inherit

.github/workflows/update-changelog.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)