Skip to content

Commit 64f3c2a

Browse files
committed
Add npm publishing workflow
1 parent 2b91919 commit 64f3c2a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish-npm.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish to npmjs.com
2+
on:
3+
push:
4+
tags: ['v*'] # Triggers when pushing tags starting with 'v'
5+
jobs:
6+
publish:
7+
if: github.repository == 'ruby/prism'
8+
runs-on: ubuntu-latest
9+
environment: release # Optional: for enhanced security
10+
permissions:
11+
id-token: write # Required for OIDC token exchange
12+
steps:
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@v2
15+
with:
16+
egress-policy: audit
17+
- uses: actions/checkout@v5
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: ${{ matrix.ruby }}
23+
24+
- name: Set up node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
registry-url: 'https://registry.npmjs.org'
29+
30+
- name: Install dependencies
31+
run: bundle install --jobs 4 --retry 3
32+
33+
- name: rake templates
34+
run: bundle exec rake templates
35+
36+
- name: Set up WASI-SDK
37+
run: |
38+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
39+
tar xvf wasi-sdk-25.0-x86_64-linux.tar.gz
40+
41+
- name: Build the project
42+
run: make wasm WASI_SDK_PATH=$(pwd)/wasi-sdk-25.0-x86_64-linux
43+
44+
- name: Update npm
45+
run: npm install -g npm@latest
46+
47+
- run: npm publish

0 commit comments

Comments
 (0)