Skip to content

Commit f8e74d6

Browse files
committed
fix: enforce OIDC-only beta publish path
1 parent 28f0564 commit f8e74d6

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
name: Release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
tag_name:
7-
description: Release tag name (e.g., v1.0.0-beta.1)
8-
type: string
9-
default: ''
104
workflow_call:
115
inputs:
126
tag_name:
13-
description: Release tag name (e.g., v1.0.0-beta.1)
7+
description: Release tag name (e.g., v0.12.0-beta.1)
148
type: string
159
default: ''
1610

@@ -32,9 +26,6 @@ jobs:
3226
registry-url: 'https://registry.npmjs.org'
3327
cache: pnpm
3428

35-
- name: Remove token auth from npmrc (use OIDC instead)
36-
run: sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"
37-
3829
- name: Install
3930
run: pnpm install
4031

@@ -46,13 +37,20 @@ jobs:
4637
env:
4738
TAG_NAME: ${{ inputs.tag_name }}
4839
run: |
49-
if [[ "$TAG_NAME" == *"-"* ]]; then
40+
VERSION="${TAG_NAME#v}"
41+
42+
if [[ -z "$VERSION" ]]; then
43+
VERSION="$(node -p "require('./package.json').version")"
44+
fi
45+
46+
if [[ "$VERSION" == *"-"* ]]; then
5047
echo "tag=beta" >> "$GITHUB_OUTPUT"
5148
else
5249
echo "tag=latest" >> "$GITHUB_OUTPUT"
5350
fi
5451
5552
- name: Publish
5653
run: |
54+
sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"
5755
unset NODE_AUTH_TOKEN
5856
pnpm publish --tag ${{ steps.npm-tag.outputs.tag }} --access public --no-git-checks --provenance

0 commit comments

Comments
 (0)