-
Notifications
You must be signed in to change notification settings - Fork 5
166 lines (134 loc) · 4.62 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Auto-release
on:
push:
branches:
- main
paths:
- grammar.js
- src/**/*
- corpus/**/*
jobs:
build-release-linux:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get Node.js ${{ matrix.node-version }}
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Build and test
run: |
npm ci
npm run build --if-present
npm run test
mv /home/runner/.cache/tree-sitter/lib/css_in_js.so /home/runner/.cache/tree-sitter/lib/libtree-sitter-css-in-js.so
- name: Create tar file
uses: TheDoctor0/[email protected]
with:
type: tar
directory: /home/runner/.cache/tree-sitter/lib
path: libtree-sitter-css-in-js.so
filename: linux.tar.gz
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: linux-latest
path: /home/runner/.cache/tree-sitter/lib/linux.tar.gz
if-no-files-found: error
retention-days: 1
build-release-windows:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Get Node.js ${{ matrix.node-version }}
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Build and test
run: |
npm ci
npm run build --if-present
npm run test
copy C:\Users\runneradmin\AppData\Local\tree-sitter\lib\css_in_js.dll C:\Users\runneradmin\AppData\Local\tree-sitter\lib\libtree-sitter-css-in-js.dll
- name: Create tar file
uses: TheDoctor0/[email protected]
with:
type: tar
directory: C:\Users\runneradmin\AppData\Local\tree-sitter\lib
path: libtree-sitter-css-in-js.dll
filename: windows.tar.gz
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: windows-latest
path: C:\Users\runneradmin\AppData\Local\tree-sitter\lib\windows.tar.gz
if-no-files-found: error
retention-days: 1
build-release-macos:
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Get Node.js ${{ matrix.node-version }}
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Build and test
run: |
npm ci
npm run build --if-present
npm run test
mv /Users/runner/Library/Caches/tree-sitter/lib/css_in_js.so /Users/runner/Library/Caches/tree-sitter/lib/libtree-sitter-css-in-js.so
# arm64
gcc -fPIC -c -I./src src/parser.c src/scanner.c -target arm64-apple-macos11
cc -fPIC -shared parser.o scanner.o -o "libtree-sitter-css-in-js.dylib" -target arm64-apple-macos11
mv libtree-sitter-css-in-js.dylib /Users/runner/Library/Caches/tree-sitter/lib
- name: Create tar file
uses: TheDoctor0/[email protected]
with:
type: tar
directory: /Users/runner/Library/Caches/tree-sitter/lib
path: libtree-sitter-css-in-js.*
filename: macos.tar.gz
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: macos-latest
path: /Users/runner/Library/Caches/tree-sitter/lib/macos.tar.gz
if-no-files-found: error
retention-days: 1
generate-release:
runs-on: ubuntu-latest
needs: [ build-release-macos, build-release-windows, build-release-linux ]
#needs: [ build-release-linux ]
permissions:
contents: write
steps:
- name: Collect tarballs
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: Publish release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Grammar binaries bundle"
files: |
artifacts/linux-latest/linux.tar.gz
artifacts/windows-latest/windows.tar.gz
artifacts/macos-latest/macos.tar.gz