File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7373 run : |
7474 # Prerelease tags publish under their own identifier (alpha, beta, rc);
7575 # only a plain vX.Y.Z tag is allowed to move the `latest` dist-tag.
76- PREID=$(sed -n 's/^v[0-9]\+\.[0-9]\+\.[0-9]\+-\([a-z][a-z0-9]*\).*/\1/p' <<<"$GITHUB_REF_NAME")
77- pnpm publish -r --access=public --no-git-checks ${PREID:+--tag="$PREID"}
76+ VERSION="${GITHUB_REF_NAME#v}"
77+ if [[ "$VERSION" != *-* ]]; then
78+ pnpm publish -r --access=public --no-git-checks
79+ exit 0
80+ fi
81+
82+ PREID="${VERSION#*-}"
83+ PREID="${PREID%%.*}"
84+ # npm rejects a dist-tag that parses as a semver range, so a numeric
85+ # identifier has no channel to publish under.
86+ if [[ ! "$PREID" =~ ^[A-Za-z][A-Za-z0-9-]*$ ]]; then
87+ echo "Refusing to publish $GITHUB_REF_NAME: '$PREID' cannot be an npm dist-tag" >&2
88+ exit 1
89+ fi
90+ pnpm publish -r --access=public --no-git-checks --tag="$PREID"
7891 env :
7992 NPM_CONFIG_PROVENANCE : true
8093 # Surfaces npm's OIDC token exchange, which is otherwise silent.
Original file line number Diff line number Diff line change 3434# out here.
3535PREID=()
3636if [ $# -eq 2 ]; then
37+ if [[ ! " $2 " =~ ^[a-z][a-z0-9-]* $ ]]; then
38+ echo " Invalid prerelease identifier: '$2 ' (expected e.g. alpha, beta, rc)"
39+ exit 1
40+ fi
3741 PREID=(--preid " $2 " )
3842fi
3943
You can’t perform that action at this time.
0 commit comments