forked from espanso/espanso
-
Notifications
You must be signed in to change notification settings - Fork 0
282 lines (262 loc) · 11 KB
/
create-release-draft.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
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
280
281
282
name: Create release draft
on: workflow_dispatch
env:
GH_TOKEN: ${{ github.token }}
jobs:
extract-version:
name: extract-version
continue-on-error: false
runs-on: ubuntu-latest
outputs:
espanso_version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: "Extract version"
id: "version"
run: |
ESPANSO_VERSION=$(grep '^version' espanso/Cargo.toml | awk -F '"' '{ print $2 }')
echo version: $ESPANSO_VERSION
echo "::set-output name=version::v$ESPANSO_VERSION"
# example output: v2.2.1
create-release:
name: create-release
needs: ["extract-version"]
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Create new release
# gh release create docs: https://cli.github.com/manual/gh_release_create
run: |
COMMIT_HASH=$(git rev-list --max-count=1 HEAD)
echo "Creating release: ${{ needs.extract-version.outputs.espanso_version }}"
echo "for hash: $COMMIT_HASH"
gh release create ${{ needs.extract-version.outputs.espanso_version }} \
--title ${{ needs.extract-version.outputs.espanso_version }} \
--notes "Automatically released by CI" \
--verify-tag \
--prerelease \
--target $COMMIT_HASH
windows:
needs: ["extract-version", "create-release"]
runs-on: windows-latest
continue-on-error: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Install rust-script and cargo-make
run: |
cargo install rust-script
cargo install --force cargo-make --version 0.37.5
- name: Test
run: cargo make --profile release -- test-binary
- name: Build resources
run: cargo make --profile release -- build-windows-resources
- name: Build installer
run: cargo make --profile release --skip-tasks build-windows-resources -- build-windows-installer
- name: Build portable mode archive
run: cargo make --profile release --skip-tasks build-windows-resources -- build-windows-portable
- name: Create portable mode archive
shell: powershell
run: |
Rename-Item -Path target/windows/portable -NewName espanso-portable
Compress-Archive -Path target/windows/espanso-portable Espanso-Win-Portable-x86_64.zip
- name: Calculate hashes
shell: powershell
run: |
Get-FileHash Espanso-Win-Portable-x86_64.zip -Algorithm SHA256 | select-object -ExpandProperty Hash > Espanso-Win-Portable-x86_64.zip.sha256.txt
Move-Item -Path .\target\windows\installer\Espanso-Win-Installer-x86_64.exe -Destination Espanso-Win-Installer-x86_64.exe
Get-FileHash Espanso-Win-Installer-x86_64.exe -Algorithm SHA256 | select-object -ExpandProperty Hash > Espanso-Win-Installer-x86_64.exe.sha256.txt
- uses: actions/upload-artifact@v4
id: upload-artifact-windows
name: upload-unsigned-artifact
with:
name: Windows Artifacts
path: |
.\Espanso-Win-Installer-x86_64.exe
.\Espanso-Win-Portable-x86_64.zip
- id: sign-windows-release
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'e86b1459-62fc-4c7c-aac9-185d60749a03'
project-slug: 'espanso'
signing-policy-slug: 'test-signing'
github-artifact-id: ${{ steps.upload-artifact-windows.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: '.'
parameters: |
version: "${{ needs.extract-version.outputs.espanso_version }}"
- name: 'DEBUG: List items of ./'
shell: powershell
run: |
Get-ChildItem .
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Win-Installer-x86_64.exe Espanso-Win-Portable-x86_64.zip Espanso-Win-Installer-x86_64.exe.sha256.txt Espanso-Win-Portable-x86_64.zip.sha256.txt
linux-x11:
needs: ["extract-version", "create-release"]
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Build docker image
run: |
sudo docker build -t espanso-ubuntu . -f .github/scripts/Dockerfile
- name: Build AppImage
run: |
sudo docker run --rm -v "$(pwd):/shared" espanso-ubuntu espanso/.github/scripts/ubuntu/build_appimage.sh
- uses: actions/upload-artifact@v4
name: upload-unsigned-artifact
with:
name: Linux X11 Artifacts
path: |
Espanso-X11.AppImage
Espanso-X11.AppImage.sha256.txt
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-X11.AppImage Espanso-X11.AppImage.sha256.txt
linux-deb:
needs: ["extract-version", "create-release"]
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Build docker image
run: |
sudo docker build -t espanso-ubuntu . -f .github/scripts/Dockerfile
- name: Build Deb packages
run: |
sudo docker run --rm -v "$(pwd):/shared" espanso-ubuntu espanso/.github/scripts/ubuntu/build_deb.sh
- uses: actions/upload-artifact@v4
name: upload-unsigned-artifact
with:
name: Ubuntu-Debian Artifacts
path: |
espanso-debian-x11-amd64.deb
espanso-debian-wayland-amd64.deb
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} espanso-debian-x11-amd64.deb espanso-debian-wayland-amd64.deb espanso-debian-x11-amd64-sha256.txt espanso-debian-wayland-amd64-sha256.txt
macos-intel:
needs: ["extract-version", "create-release"]
runs-on: macos-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Install rust-script and cargo-make
run: |
cargo install rust-script
cargo install --force cargo-make --version 0.37.5
- name: Test
run: cargo make --profile release -- test-binary
env:
MACOSX_DEPLOYMENT_TARGET: "10.13"
- name: Build
run: cargo make --profile release -- create-bundle
env:
MACOSX_DEPLOYMENT_TARGET: "10.13"
- name: Create ZIP archive
run: |
ditto -c -k --sequesterRsrc --keepParent target/mac/Espanso.app Espanso-Mac-Intel.zip
- uses: actions/upload-artifact@v4
name: upload-unsigned-artifact
id: upload-artifact-macos-intel
with:
name: Mac Intel Artifacts
path: |
./Espanso-Mac-Intel.zip
- id: sign-macos-intel-release
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'e86b1459-62fc-4c7c-aac9-185d60749a03'
project-slug: 'espanso'
signing-policy-slug: 'test-signing'
github-artifact-id: ${{ steps.upload-artifact-macos-intel.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: '.'
parameters: |
version: "${{ needs.extract-version.outputs.espanso_version }}"
- name: Calculate hashes
run: |
shasum -a 256 Espanso-Mac-Intel.zip > Espanso-Mac-Intel.zip.sha256.txt
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-Intel.zip Espanso-Mac-Intel.zip.sha256.txt
macos-m1:
needs: ["extract-version", "create-release"]
runs-on: macos-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: Install rust target
run: rustup update && rustup target add aarch64-apple-darwin
- name: Install rust-script and cargo-make
run: |
cargo install rust-script
cargo install --force cargo-make --version 0.37.5
- name: Build
run: cargo make --env BUILD_ARCH=aarch64-apple-darwin --profile release -- create-bundle
- name: Create ZIP archive
run: |
ditto -c -k --sequesterRsrc --keepParent target/mac/Espanso.app Espanso-Mac-M1.zip
- uses: actions/upload-artifact@v4
name: upload-unsigned-artifact
id: upload-artifact-macos-m1
with:
name: Mac M1 Artifacts
path: |
./Espanso-Mac-M1.zip
- id: sign-macos-m1-release
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'e86b1459-62fc-4c7c-aac9-185d60749a03'
project-slug: 'espanso'
signing-policy-slug: 'test-signing'
github-artifact-id: ${{ steps.upload-artifact-macos-m1.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: '.'
parameters: |
version: "${{ needs.extract-version.outputs.espanso_version }}"
- name: Calculate hashes
run: |
shasum -a 256 Espanso-Mac-M1.zip > Espanso-Mac-M1.zip.sha256.txt
- name: Upload artifacts to Github Releases
run: |
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-M1.zip Espanso-Mac-M1.zip.sha256.txt
macos-publish-homebrew:
needs: ["extract-version", "create-release", "macos-m1", "macos-intel"]
runs-on: macos-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Print target version
run: |
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
- name: "Setup SSH deploy key"
uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd
with:
ssh-private-key: ${{ secrets.HOMEBREW_CASK_SSH_PRIVATE_KEY }}
- name: Create and Publish Homebrew Cask
run: |
VERSION="${{ needs.extract-version.outputs.espanso_version }}" ./scripts/publish_homebrew_version.sh
echo "Cask formula has been published here: "