-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (94 loc) · 2.8 KB
/
release.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Recreated from
# https://github.com/tree-sitter/workflows/blob/0ddf14c2d6cb042a24f9b9bd9c2912f811aac862/.github/workflows/package-npm.yml
name: Build package (npm)
on:
# push:
# branches:
# - main
workflow_dispatch: null
workflow_call:
inputs:
package-name:
description: The name of the package
default: ${{github.event.repository.name}}
type: string
environment-name:
description: The name of the environment
default: npm
type: string
node-version:
description: The NodeJS version
default: ${{vars.NODE_VERSION || '20'}}
type: string
ubuntu-version:
description: The version of the Ubuntu runner image
default: ${{vars.UBUNTU_VERSION || '20.04'}}
type: string
generate:
description: Generate the parser artifacts
default: false
type: boolean
secrets:
NODE_AUTH_TOKEN:
description: An authentication token for npm
required: true
jobs:
build_node:
name: Build NodeJS binaries on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- "ubuntu-${{inputs.ubuntu-version}}"
- windows-latest
- macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Build x64 binary
run: pnpm -r build
- name: Test binary
run: pnpm -r test
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
path: packages/**/parser.so
name: parsers-${{runner.os}}
retention-days: 2
# package:
# name: Publish NodeJS package
# needs: [build_wasm, build_node]
# runs-on: ubuntu-${{inputs.ubuntu-version}}
# environment:
# name: ${{inputs.environment-name}}
# url: https://www.npmjs.com/package/${{inputs.package-name}}
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Set up NodeJS
# uses: actions/setup-node@v4
# with:
# cache: npm
# node-version: ${{inputs.node-version}}
# registry-url: https://registry.npmjs.org/
# - name: Download binaries
# uses: actions/download-artifact@v4
# with:
# path: prebuilds
# pattern: prebuilds-*
# merge-multiple: true
# - name: Check binaries
# run: tree prebuilds
# - name: Move Wasm binaries to root
# continue-on-error: true
# run: mv -v prebuilds/*.wasm .
# - name: Publish to npm
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}