Skip to content

Commit 20203f6

Browse files
author
DavertMik
committed
publish beta workflow
1 parent 05d22f9 commit 20203f6

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/publish-beta.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
name: Publish to npm
14+
runs-on: ubuntu-22.04
15+
if: ${{ github.event.release.prerelease || contains(github.event.release.tag_name, 'alpha') || contains(github.event.release.tag_name, 'beta') || contains(github.event.release.tag_name, 'rc') }}
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version: '20.x'
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Install dependencies
28+
run: npm i
29+
env:
30+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
31+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
32+
33+
- name: Determine npm tag
34+
id: npm_tag
35+
run: |
36+
TAG="${{ github.event.release.tag_name }}"
37+
if echo "$TAG" | grep -qE "alpha|-alpha|\.a\."; then
38+
echo "tag=alpha" >> $GITHUB_OUTPUT
39+
elif echo "$TAG" | grep -qE "beta|-beta|\.b\."; then
40+
echo "tag=beta" >> $GITHUB_OUTPUT
41+
elif echo "$TAG" | grep -qE "rc|-rc|\.rc\."; then
42+
echo "tag=rc" >> $GITHUB_OUTPUT
43+
elif [ "${{ github.event.release.prerelease }}" = "true" ]; then
44+
echo "tag=beta" >> $GITHUB_OUTPUT
45+
else
46+
echo "tag=latest" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Publish to npm
50+
run: npm publish --provenance --access public --tag ${{ steps.npm_tag.outputs.tag }}
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}

0 commit comments

Comments
 (0)