Skip to content

Commit 59a220d

Browse files
authored
Merge pull request #23 from escendit/22-package-to-public-npm
Add npm registry workflow for automatic package publishing
2 parents 9b91ff7 + 78bb83a commit 59a220d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/npm-registry.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "npm"
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- "Release"
7+
types:
8+
- completed
9+
permissions:
10+
contents: read
11+
jobs:
12+
pack:
13+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
14+
name: "Pack"
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Checkout
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
# Setup Bun
23+
- uses: oven-sh/setup-bun@v2
24+
with:
25+
bun-version: 1.3.1
26+
# Install dependencies
27+
- name: Install dependencies
28+
run: bun install
29+
# Set Version
30+
- name: Set TAG variable
31+
run: echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
32+
- name: Set VERSION variable
33+
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
34+
- name: Set Version
35+
run: npm version $VERSION --no-git-tag-version
36+
# Publish
37+
- name: Publish
38+
run: npm publish --access public
39+
env:
40+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)