Skip to content

Commit af253c2

Browse files
author
lkn
committed
feat(ci): add github actions publish
1 parent eef9384 commit af253c2

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*.[0-9]*.[0-9]*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
registry-url: 'https://registry.npmjs.org'
17+
18+
- name: Install dependencies
19+
run: npm install --legacy-peer-deps
20+
21+
- name: Build
22+
run: npm run build
23+
24+
- name: Run tests
25+
run: npm test
26+
env:
27+
LING_1T_API_KEY: ${{ secrets.LING_1T_API_KEY }}
28+
29+
- name: Publish to NPM
30+
run: |
31+
if [[ "${{ github.ref_name }}" == *"-alpha"* ]]; then
32+
npm publish --tag alpha
33+
elif [[ "${{ github.ref_name }}" == *"-beta"* ]]; then
34+
npm publish --tag beta
35+
else
36+
npm publish
37+
fi
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)