This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
227 lines (193 loc) · 6.41 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
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
name: Create a release
on:
push:
tags:
- '*'
env:
NIMVER: "1.6.0"
jobs:
build-linux-win:
runs-on: ubuntu-18.04
strategy:
matrix:
bintype: [linux, win-i386, win-amd64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache nim, nimble
uses: actions/cache@v2
id: cache
with:
key: build-${{ matrix.bintype }}-nim-${{ env.NIMVER }}--1
path: |
nim
~/.nimble
- name: Install mingw
if: matrix.bintype != 'linux'
run: sudo apt-get install -y --no-install-recommends mingw-w64
- name: Download nim
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir nim
cd nim
wget https://nim-lang.org/download/nim-$NIMVER-linux_x64.tar.xz
tar xf nim-$NIMVER-linux_x64.tar.xz
- name: Set up PATH
run: echo "PATH=$PWD/nim/nim-$NIMVER/bin:$PATH" >> $GITHUB_ENV
- name: Install nimble packages
run: nimble install --depsOnly -y
- name: Compile for Linux
if: matrix.bintype == 'linux'
run: nimble build -d:release
- name: Upload Linux artifact
if: matrix.bintype == 'linux'
uses: actions/upload-artifact@v2
with:
name: nwsync.linux.amd64
path: bin/*
- name: Compile for Windows i386
if: matrix.bintype == 'win-i386'
# on Ubuntu the binary has no .exe extension for some reason
run: |
nimble build -d:release -d:mingw --cpu:i386
for f in bin/*; do mv "$f" "$f.exe"; done
- name: Upload Windows i386 artifact
if: matrix.bintype == 'win-i386'
uses: actions/upload-artifact@v2
with:
name: nwsync.windows.i386
path: bin/*
- name: Compile for Windows amd64
if: matrix.bintype == 'win-amd64'
run: |
nimble build -d:release -d:mingw --cpu:amd64
for f in bin/*; do mv "$f" "$f.exe"; done
- name: Upload Windows amd64 artifact
if: matrix.bintype == 'win-amd64'
uses: actions/upload-artifact@v2
with:
name: nwsync.windows.amd64
path: bin/*
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache nim, nimble
uses: actions/cache@v2
id: cache
with:
key: build-macos-${{ env.NIMVER }}--1
path: |
nim
~/.nimble
- name: Download and build nim, add to PATH
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir nim
cd nim
wget https://nim-lang.org/download/nim-$NIMVER.tar.xz
tar xf nim-$NIMVER.tar.xz
cd nim-$NIMVER
sh build.sh
bin/nim c koch
./koch boot -d:release
./koch tools
- name: Set up PATH
run: echo "PATH=$PWD/nim/nim-$NIMVER/bin:$PATH" >> $GITHUB_ENV
- name: Install nimble packages
run: nimble install --depsOnly -y
- name: Compile for macOS
run: nimble build -d:release
- name: Upload macOS artifact
uses: actions/upload-artifact@v2
with:
name: nwsync.macos.amd64
path: bin/*
release:
needs: [build-linux-win, build-macos]
runs-on: ubuntu-18.04
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v2
with:
name: nwsync.linux.amd64
path: bin-linux
- name: Pack Linux artifact
# the executable flag is removed on artifact upload
working-directory: bin-linux
run: |
chmod +x *
zip nwsync.linux.amd64.zip *
- name: Download Windows i386 artifact
uses: actions/download-artifact@v2
with:
name: nwsync.windows.i386
path: bin-windows-i386
- name: Pack Windows i386 artifact
working-directory: bin-windows-i386
run: zip nwsync.windows.i386.zip *
- name: Download Windows amd64 artifact
uses: actions/download-artifact@v2
with:
name: nwsync.windows.amd64
path: bin-windows-amd64
- name: Pack Windows amd64 artifact
working-directory: bin-windows-amd64
run: zip nwsync.windows.amd64.zip *
- name: Download macOS artifact
uses: actions/download-artifact@v2
with:
name: nwsync.macos.amd64
path: bin-macos
- name: Pack macOS artifact
working-directory: bin-macos
run: |
chmod +x *
zip nwsync.macosx.amd64.zip *
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Linux release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin-linux/nwsync.linux.amd64.zip
asset_name: nwsync.linux.amd64.zip
asset_content_type: application/zip
- name: Upload Windows i386 release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin-windows-i386/nwsync.windows.i386.zip
asset_name: nwsync.windows.i386.zip
asset_content_type: application/zip
- name: Upload Windows amd64 release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin-windows-amd64/nwsync.windows.amd64.zip
asset_name: nwsync.windows.amd64.zip
asset_content_type: application/zip
- name: Upload macOS release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin-macos/nwsync.macosx.amd64.zip
asset_name: nwsync.macosx.amd64.zip
asset_content_type: application/zip