-
Notifications
You must be signed in to change notification settings - Fork 2
224 lines (181 loc) · 5.63 KB
/
main.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
strategy:
matrix:
node-version: [12.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up pnpm 5
uses: pnpm/action-setup@v1.2.1
with:
version: 5.7.x
- name: pnpm install
run: pnpm install
- name: Compile .node
run: npm run build-debug
- name: Test
run: npm test
build-release:
name: Build release for Node
needs: test
if: ${{ startsWith(github.event.head_commit.message, 'release') }}
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up pnpm 5
uses: pnpm/action-setup@v1.2.1
with:
version: 5.7.x
- name: pnpm install
run: pnpm install
- name: Compile .node
run: npm run build-release
- name: Tag .node as prebuild
run: npm run tag-prebuild
- name: Upload prebuild artifacts
uses: actions/upload-artifact@v2
with:
name: prebuilds
path: prebuilds/
build-release-electron:
name: Build release for Electron
needs: test
if: ${{ startsWith(github.event.head_commit.message, 'release') }}
strategy:
matrix:
electron-version: [7, 8, 9, 10]
node-version: [12.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up pnpm 5
uses: pnpm/action-setup@v1.2.1
with:
version: 5.7.x
- name: pnpm install
run: pnpm install
- name: Install Electron ${{ matrix.electron-version }}
run: pnpm install electron@${{ matrix.electron-version }}
- name: Compile .node
run: npm run build-release-electron
- name: Tag .node as prebuild
run: npm run tag-prebuild-electron
- name: Upload prebuild artifacts
uses: actions/upload-artifact@v2
with:
name: prebuilds
path: prebuilds/
publish:
name: NPM Publish
needs: [build-release, build-release-electron]
if: ${{ startsWith(github.event.head_commit.message, 'release') }}
strategy:
matrix:
node-version: [12.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- name: Download prebuild artifacts
uses: actions/download-artifact@v2
with:
name: prebuilds
path: prebuilds
- name: Check prebuilds
run: ls -laR prebuilds
- name: NPM Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
replace:
name: Update replacer branch
needs: [publish]
if: ${{ startsWith(github.event.head_commit.message, 'release') }}
strategy:
matrix:
node-version: [12.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Download prebuild artifacts
uses: actions/download-artifact@v2
with:
name: prebuilds
path: prebuilds
- name: Check prebuilds
run: ls -laR prebuilds
- name: Set package.json name to "ssb-keys"
run: node .github/set-pkg-replacer-name.js
- name: Detect version to replace
run: echo "BRANCH_VERSION=$(node .github/get-pkg-version.js)" >> $GITHUB_ENV
- name: Delete git branch replace-${{ env.BRANCH_VERSION }}
uses: dawidd6/action-delete-branch@v3
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: replace-${{ env.BRANCH_VERSION }}
- name: Push git branch replace-${{ env.BRANCH_VERSION }}
uses: github-actions-x/commit@v2.7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'replace-${{ env.BRANCH_VERSION }}'
commit-message: 'update replacer branch'
force-add: 'true'
files: package.json prebuilds/
name: Andre Staltz
email: andre@staltz.com