-
Notifications
You must be signed in to change notification settings - Fork 4
247 lines (203 loc) · 7.8 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
on:
push:
tags:
- 'v*'
- 'test*'
name: Create release
jobs:
build-linux:
name: Create Linux x86_64 release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.upload.outputs.upload_url }}
tag: ${{ steps.vars.outputs.tag }}
steps:
- uses: actions/checkout@v2
- name: Set tag output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Create vendored crates
id: vendor
run: |
output=$(./scripts/cargo_vendor.sh ${{ steps.vars.outputs.tag }} | tail -1 | tr -d '\n')
echo ::set-output name=filename::$output
- name: Install deps
run: sudo apt update && sudo apt install libdbus-1-dev libgtk-3-dev libglib2.0-dev libcairo-gobject2 libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-0
- name: Build release binary
run: cargo build --release
- name: Create the package
id: package
run: echo ::set-output name=filename::$(./scripts/package.sh ${{ steps.vars.outputs.tag }} | tail -1 | tr -d '\n')
- name: Calculate the checksum
id: checksum
run: echo ::set-output name=sha::$(sha256sum ./build/${{ steps.package.outputs.filename }} | sed 's/\.\/build\///g' | tr -d '\n')
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: ${{ steps.vars.outputs.tag }}
body: |
## Notable changes
-
## Checksums (sha256)
${{ steps.checksum.outputs.sha }}
draft: true
prerelease: false
- name: Upload release asset
id: upload-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: ./build/${{ steps.package.outputs.filename }}
asset_name: ${{ steps.package.outputs.filename }}
asset_content_type: application/gzip
- name: Upload vendored crates for Flatpak
id: upload-vendored-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./vendored/${{ steps.vendor.outputs.filename }}
asset_name: ${{ steps.vendor.outputs.filename }}
asset_content_type: application/gzip
- name: Set release outputs
id: upload
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"
gvsbuild:
name: Build GTK libs for Windows
runs-on: windows-2019
needs: build-linux
env:
gvsbuildref: 679fa3bdf342ed2b199977b075da8263a04b3c05
gvsbuildupdate: 1
outputs:
cachekey: ${{ steps.output.outputs.cachekey }}
steps:
- name: (GTK binaries) create dir
run: mkdir C:\gtk-build\gtk\x64\release
- name: (GTK binaries) get from cache
uses: actions/cache@v2
id: cache
with:
path: C:\gtk-build\gtk\x64\release\**
key: gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}
- name: (GTK binaries) checkout gvsbuild
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: wingtk/gvsbuild
ref: ${{ env.gvsbuildref }}
path: gvsbuild
- name: (GTK binaries) move git binary
if: steps.cache.outputs.cache-hit != 'true'
run: move "C:\Program Files\Git\usr\bin" "C:\Program Files\Git\usr\notbin"
shell: cmd
- name: (GTK binaries) run gvsbuild
if: steps.cache.outputs.cache-hit != 'true'
working-directory: gvsbuild
run: python .\build.py build -p=x64 --vs-ver=16 --msys-dir=C:\msys64 gtk3
- name: (GTK binaries) restore git binary
if: steps.cache.outputs.cache-hit != 'true'
run: move "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
shell: cmd
- name: (GTK binaries) output cache key
id: output
run: echo "::set-output name=cachekey::gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}"
build-windows:
name: Create Windows x64 release
runs-on: windows-latest
needs: [build-linux, gvsbuild]
steps:
- name: Create GTK binaries dir
run: mkdir C:\gtk-build\gtk\x64\release
- name: Get GTK binaries from cache
uses: actions/cache@v2
id: cache
with:
path: C:\gtk-build\gtk\x64\release\**
key: ${{ needs.gvsbuild.outputs.cachekey }}
- name: Set up env
run: |
echo "PKG_CONFIG=C:\gtk-build\gtk\x64\release\bin\pkgconf.exe" >> $GITHUB_ENV
echo "C:\gtk-build\gtk\x64\release\bin" >> $GITHUB_PATH
shell: bash
- name: Create target path
run: mkdir C:\build
- uses: actions/checkout@v2
- name: Compile icon resource
run: |
# TODO: how to call the rc without copying it?
ls "C:/Program Files (x86)/"
ls "C:/Program Files (x86)/Windows Kits/"
ls "C:/Program Files (x86)/Windows Kits/10/bin/"
cp $env:RC_BIN\rc.exe src\
cp $env:RC_BIN\rcdll.dll src\
cd src
.\rc.exe dragit.rc
ls
env:
RC_BIN: C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64/
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: Create linker config for the icon
run: |
$repoPath = $env:GITHUB_WORKSPACE -replace "\\", "/"
mkdir .cargo
Set-Content -Path .\.cargo\config -Value "[build]`nrustflags = [`"-Clink-args=${repoPath}/src/dragit.res`"]"
Get-Content .\.cargo\config
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target-dir C:\build
- uses: msys2/setup-msys2@v2
with:
update: true
location: C:\msys2
install: >-
mingw-w64-x86_64-adwaita-icon-theme
mingw-w64-x86_64-hicolor-icon-theme
- name: Copy dependencies
run: |
mkdir $env:PACKAGE_DIR
mkdir $env:PACKAGE_DIR\bin\
mkdir $env:PACKAGE_DIR\lib\
mkdir $env:PACKAGE_DIR\share\
ls C:\gtk-build\gtk\x64\release\bin\
cp C:\build\release\dragit.exe $env:PACKAGE_DIR\bin\
# Those dlls and binaries are provided by gvsbuild
foreach($line in Get-Content .\scripts\windows_deps.txt) {
cp C:\gtk-build\gtk\x64\release\bin\$line $env:PACKAGE_DIR\bin\
}
ls C:\msys2\msys64\mingw64\bin\
cp C:\msys2\msys64\mingw64\bin\libexpat-1.dll $env:PACKAGE_DIR\bin\expat.dll
cp -r C:\gtk-build\gtk\x64\release\share\glib-2.0 $env:PACKAGE_DIR\share\
# Icons are installed from msys2.
cp -r C:\msys2\msys64\mingw64\share\icons $env:PACKAGE_DIR\share\
# https://github.com/gtk-rs/gtk/issues/422
cp -r C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0 $env:PACKAGE_DIR\lib\
cp static\README.md $env:PACKAGE_DIR\
env:
PACKAGE_DIR: C:\build\dragit
- name: Build zip package
run: |
cd C:\build\
tar.exe -a -c -f C:\build\dragit_package.zip dragit
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build-linux.outputs.upload_url }}
asset_path: C:\build\dragit_package.zip
asset_name: dragit_${{ needs.build-linux.outputs.tag }}_windows_x64.zip
asset_content_type: application/zip