forked from kcl-lang/lib
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.32 KB
/
wasm-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: wasm-test
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
paths:
- "wasm/**"
- ".github/workflows/wasm-test.yaml"
workflow_dispatch:
jobs:
test-and-release:
name: Test and Release
runs-on: ubuntu-latest
permissions:
id-token: write
# Notes: this defaults only apply on run tasks.
defaults:
run:
working-directory: "wasm"
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install dependencies
run: npm install
- name: Build
run: npm run compile
- name: Publish Dry Run
if: "startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')"
# Since this command will not exit with non-zero code when file missing,
# we need to check the output manually.
run: |
npm publish --access public --provenance --dry-run
- name: Publish
if: "startsWith(github.ref, 'refs/tags/')"
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public --provenance
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}