Skip to content

Commit a9e4dc8

Browse files
authored
feat: introduce action to publish to npm (#31)
1 parent 1723599 commit a9e4dc8

File tree

2 files changed

+53
-32
lines changed

2 files changed

+53
-32
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
name: CI
22

33
on:
4-
pull_request:
5-
branches:
6-
- '**'
7-
push:
8-
branches:
9-
- 'main'
4+
pull_request:
5+
branches:
6+
- '**'
7+
push:
8+
branches:
9+
- 'main'
1010

1111
concurrency:
12-
group: ${{ github.workflow }}-${{ github.ref }}
13-
cancel-in-progress: true
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
1414

1515
jobs:
16-
test:
17-
name: Run validation tests
18-
runs-on: ${{ matrix.os }}
19-
strategy:
20-
fail-fast: true
21-
matrix:
22-
os: [macos-latest, ubuntu-latest, windows-latest]
23-
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v3
16+
test:
17+
name: Run validation tests
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: true
21+
matrix:
22+
os: [macos-latest, ubuntu-latest, windows-latest]
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
2626

27-
- name: Install Node.js
28-
uses: actions/setup-node@v3
29-
with:
30-
node-version: 16
27+
- name: Install Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 16
3131

32-
- name: Install dependencies
33-
run: npm install
32+
- name: Install dependencies
33+
run: npm install
3434

35-
- name: Run tree-sitter tests
36-
run: npm test
35+
- name: Run tree-sitter tests
36+
run: npm test
3737

38-
- name: Ensure generated parser files are up-to-date
39-
# On Windows, tree-sitter generate results in a diff, not sure why
40-
if: runner.os != 'Windows'
41-
run: |
42-
git status
43-
test -z "$(git status --porcelain)"
38+
- name: Ensure generated parser files are up-to-date
39+
# On Windows, tree-sitter generate results in a diff, not sure why
40+
if: runner.os != 'Windows'
41+
run: |
42+
git status
43+
test -z "$(git status --porcelain)"

.github/workflows/npm.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish to NPM
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
- name: Setup Node
12+
uses: actions/setup-node@v2
13+
with:
14+
node-version: '18.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
- name: Install dependencies and build 🔧
17+
run: npm ci && npm run build
18+
- name: Publish package on NPM 📦
19+
run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_GBPROD_GITCOMMIT }}

0 commit comments

Comments
 (0)