Skip to content

Commit a03516b

Browse files
Publish prereleases with matching npm dist-tags (#276)
1 parent 115b6f1 commit a03516b

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,19 @@ jobs:
8282
package-manager-cache: false
8383
registry-url: https://registry.npmjs.org
8484

85+
- name: Resolve npm dist-tag
86+
run: |
87+
RELEASE_VERSION=${GITHUB_REF#refs/*/}
88+
PACKAGE_VERSION=${RELEASE_VERSION#v}
89+
90+
case "$PACKAGE_VERSION" in
91+
*-alpha.*) NPM_TAG=alpha ;;
92+
*-beta.*) NPM_TAG=beta ;;
93+
*-rc.*) NPM_TAG=rc ;;
94+
*) NPM_TAG=latest ;;
95+
esac
96+
97+
echo "NPM_TAG=$NPM_TAG" >> "$GITHUB_ENV"
98+
8599
- name: Publish new version
86-
run: npm publish ./*.tgz --access public --tag=latest
100+
run: npm publish ./*.tgz --access public --tag="$NPM_TAG"

0 commit comments

Comments
 (0)