-
Notifications
You must be signed in to change notification settings - Fork 110
279 lines (268 loc) · 8.54 KB
/
release.yml
File metadata and controls
279 lines (268 loc) · 8.54 KB
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Asset
env:
RUSTFLAGS: "-D warnings"
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# Build for these versions to force backward compat with certain
# toolchains (GLIBC < 2.29 in case of ubuntu-18.04)
- ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- id: tag
uses: dawidd6/action-get-tag@v1
- run: cargo build --release --features telemetry --bin synth
- working-directory: target/release
run: tar -czf synth.tar.gz synth
- uses: actions/upload-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-${{ matrix.os }}-x86_64
path: target/release/synth.tar.gz
debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
test_tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
build-arm64:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: aarch64-unknown-linux-musl
override: true
- id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --features telemetry --bin synth --target aarch64-unknown-linux-musl
- working-directory: target/aarch64-unknown-linux-musl/release
run: tar -czf synth.tar.gz synth
- uses: actions/upload-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-ubuntu-latest-arm64
path: target/aarch64-unknown-linux-musl/release/synth.tar.gz
build-osx:
name: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- id: tag
uses: dawidd6/action-get-tag@v1
- run: cargo build --release --features telemetry --bin synth
- run: sudo /usr/sbin/purge
- working-directory: target/release
run: tar -czf synth.tar.gz synth
- uses: actions/upload-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-macos-latest-x86_64
path: target/release/synth.tar.gz
build-windows:
name: build-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- id: tag
uses: dawidd6/action-get-tag@v1
- id: version
shell: bash
run: |
VERSION=$(cargo metadata --format-version 1 | jq '.packages[] | select (.name == "synth") | .version' -r)
echo "::set-output name=version::${VERSION}"
- run: cargo build --release --features telemetry --bin synth
- id: install-wix
run: nuget install WiX -Version 3.11.2
- id: install-cargo-wix
run: cargo install cargo-wix --version 0.3.1
- id: copy-target
name: Move synth.exe into wix friendly directory
run: |
mkdir synth/target/release
copy target/release/synth.exe synth/target/release
- id: wix
name: Run cargo wix
run: |
cd synth
cargo wix --nocapture
- name: Rename output
shell: bash
run: |
cd synth
mv ./target/wix/synth-${{ steps.version.outputs.version }}-x86_64.msi \
./target/wix/synth-${{ steps.tag.outputs.tag }}-x86_64.msi
- uses: actions/upload-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-windows-msi-x86_64
path: ./synth/target/wix/synth-${{ steps.tag.outputs.tag }}-x86_64.msi
- uses: actions/upload-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-windows-x86_64
path: target/release/synth.exe
release:
name: release
needs: [ build, build-osx, build-windows, build-arm64 ]
runs-on: ubuntu-latest
steps:
- id: tag
uses: dawidd6/action-get-tag@v1
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: ${{ steps.tag.outputs.tag }}
draft: true
prerelease: false
- run: echo '${{ steps.create_release.outputs.upload_url }}' > upload_url
- uses: actions/upload-artifact@v2
with:
name: upload_url
path: ./upload_url
upload-nix-installer:
name: upload-nix-installer
needs: [ release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: upload_url
path: ./
- id: release
run: echo "##[set-output name=upload_url;]$(cat upload_url)"
- working-directory: tools/nix
run: |
cp install.nix default.nix
sed -i \
-e "s|master|$GITHUB_REF|g" \
-e "s|HEAD|$GITHUB_SHA|g" \
default.nix
tar -cvf install-nix default.nix
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./tools/nix/install-nix
asset_name: install-nix
asset_content_type: application/octet-stream
upload:
name: upload
needs: [ release ]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- build: arm64
os: ubuntu-latest
- build: x86_64
os: ubuntu-latest
- build: x86_64
os: macos-latest
- build: x86_64
os: ubuntu-18.04
steps:
- uses: actions/download-artifact@v2
with:
name: upload_url
path: ./
- id: release
run: echo "##[set-output name=upload_url;]$(cat upload_url)"
- id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/download-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-${{ matrix.os }}-${{ matrix.build }}
path: ./
- run: ls
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./synth.tar.gz
asset_name: synth-${{ matrix.os }}-${{ matrix.build}}.tar.gz
asset_content_type: application/octet-stream
upload-windows:
name: upload-windows
needs: [ release ]
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v2
with:
name: upload_url
path: ./
- id: release
run: echo "##[set-output name=upload_url;]$(cat upload_url)"
- id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/download-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-windows-x86_64
path: ./
- run: ls
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./synth.exe
asset_name: synth-windows-latest-x86_64.exe
asset_content_type: application/octet-stream
- uses: actions/download-artifact@v2
with:
name: synth-${{ steps.tag.outputs.tag }}-windows-msi-x86_64
path: ./
- name: Upload Windows installer
id: upload-windows-installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./synth-${{ steps.tag.outputs.tag }}-x86_64.msi
asset_name: synth-windows-msi-latest-x86_64.msi
asset_content_type: application/octet-stream