Skip to content

Commit de58c31

Browse files
committed
fix(release): support OIDC publish-only runs
1 parent 637b22e commit de58c31

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ name: Release
1313
required: false
1414
type: boolean
1515
default: false
16+
publish-only:
17+
description: 'Publish an already prepared version through GitHub OIDC; requires version.'
18+
required: false
19+
type: boolean
20+
default: false
1621

1722
permissions:
1823
contents: write
@@ -61,6 +66,7 @@ jobs:
6166
run: git checkout -- packages/ai/src/models.generated.ts packages/ai/src/image-models.generated.ts package-lock.json
6267

6368
- name: Run release
69+
if: inputs.publish-only != true
6470
env:
6571
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6672
SENPI_SKIP_PM_VERIFY: '1'
@@ -73,3 +79,36 @@ jobs:
7379
ARGS+=(--dry-run)
7480
fi
7581
npm run release -- "${ARGS[@]}"
82+
83+
- name: Publish prepared version
84+
if: inputs.publish-only == true
85+
env:
86+
EXPECTED_VERSION: ${{ inputs.version }}
87+
run: |
88+
test -n "$EXPECTED_VERSION" || {
89+
echo "publish-only requires an explicit version" >&2
90+
exit 1
91+
}
92+
ACTUAL_VERSION="$(node -p 'require("./packages/coding-agent/package.json").version')"
93+
test "$ACTUAL_VERSION" = "$EXPECTED_VERSION" || {
94+
echo "expected $EXPECTED_VERSION, found $ACTUAL_VERSION" >&2
95+
exit 1
96+
}
97+
npm run check
98+
CI=1 npm test
99+
node scripts/publish.mjs
100+
101+
- name: Workflow summary
102+
if: always()
103+
shell: bash
104+
run: |
105+
{
106+
echo "## Release"
107+
echo
108+
echo "| Field | Value |"
109+
echo "| --- | --- |"
110+
echo "| Job status | ${{ job.status }} |"
111+
echo "| Mode | ${{ inputs.publish-only && 'publish-only' || 'release' }} |"
112+
echo "| Version | ${{ inputs.version || 'auto' }} |"
113+
echo "| Commit | ${{ github.sha }} |"
114+
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)