-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (140 loc) · 4.16 KB
/
build.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
name: Build cross platform
permissions:
contents: write
# Controls when the action will run. Triggers the workflow on push
on:
push:
pull_request:
release:
# tags:
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC",
os: windows-latest,
artifact: win32-x64,
}
- {
name: "Ubuntu_Latest_GCC",
os: ubuntu-latest,
artifact: linux-x64,
}
- {
name: "macOS Latest Clang",
os: macos-latest,
artifact: darwin-arm64,
}
- {
name: "macOS Intel?",
os: macos-13,
artifact: darwin-x64,
}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Use Go
uses: actions/setup-go@v5
with:
go-version: '1.21.3'
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
echo github.ref: ${{ github.ref }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install node cmake
node --version
cmake --version
"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- name: Add msbuild to PATH
if: startsWith(matrix.config.os, 'windows')
uses: microsoft/setup-msbuild@v2
- name: Add setup Windows SDK
if: startsWith(matrix.config.os, 'windows')
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
s dk-version: 26100
- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'Ubuntu')
run: |
sudo apt-get update
sudo apt-get install cmake libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev pkg-config nodejs npm
cmake --version
gcc --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install cmake
cmake --version
- name: Build
shell: bash
run: |
npm ci
echo "${{ github.event_name }}"
npm run build
- name: Upload Artifact ⬆️
uses: actions/upload-artifact@v4
with:
path: ./dist/*.dawn.node
name: ${{ matrix.config.artifact }}.dawn.node
overwrite: true
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*.dawn.node
package:
needs: build
name: package-and-publish
environment: deploy
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
echo github.ref: ${{ github.ref }}
echo github.ref_type: ${{ github.ref_type }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Build
shell: bash
run: |
npm ci
node build/prep-for-publish.js
- name: Publish to NPM 📖
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: .