-
Notifications
You must be signed in to change notification settings - Fork 0
298 lines (261 loc) · 9.71 KB
/
Copy pathci.yml
File metadata and controls
298 lines (261 loc) · 9.71 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: CI
on:
pull_request:
push:
branches:
- main
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
verify:
if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]')
name: Verify CLI
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Vite+
uses: ./.github/actions/setup-vp
with:
node-version-file: ".node-version"
cache: true
- name: Install dependencies
run: vp install
- name: Verify repository
run: vp run verify
- name: Smoke test packed install surface
run: vp run smoke:pack
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]')
name: Release CLI
needs:
- verify
runs-on: ubuntu-latest
timeout-minutes: 20
environment:
name: release
deployment: false
permissions:
contents: read
id-token: write
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_git_tag: ${{ steps.semantic.outputs.new_release_git_tag }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- name: Create release bot token
id: release-bot
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.PUTIO_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.PUTIO_RELEASE_BOT_PRIVATE_KEY }}
permission-contents: write
permission-issues: write
permission-pull-requests: write
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Vite+
uses: ./.github/actions/setup-vp
with:
node-version-file: ".node-version"
cache: false
- name: Install dependencies
run: vp install
- name: Build package
run: vp run build
- name: Configure release bot remote
run: git remote set-url origin "https://x-access-token:${RELEASE_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
env:
RELEASE_BOT_TOKEN: ${{ steps.release-bot.outputs.token }}
- name: Release package
id: semantic
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
with:
extra_plugins: |
@semantic-release/commit-analyzer@13.0.1
@semantic-release/release-notes-generator@14.1.1
@semantic-release/npm@13.1.5
@semantic-release/github@12.0.8
@semantic-release/git@10.0.1
conventional-changelog-conventionalcommits@9.3.1
env:
GITHUB_TOKEN: ${{ steps.release-bot.outputs.token }}
GIT_AUTHOR_NAME: ${{ steps.release-bot.outputs.app-slug }}[bot]
GIT_AUTHOR_EMAIL: ${{ steps.release-bot.outputs.app-slug }}[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ steps.release-bot.outputs.app-slug }}[bot]
GIT_COMMITTER_EMAIL: ${{ steps.release-bot.outputs.app-slug }}[bot]@users.noreply.github.com
build-unix-binaries:
if: needs.release.outputs.new_release_published == 'true'
name: Build ${{ matrix.os }} release assets
needs:
- release
runs-on: ${{ matrix.os }}
timeout-minutes: 30
environment:
name: release
deployment: false
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
asset_os: linux
asset_arch: amd64
- os: macos-latest
asset_os: darwin
asset_arch: arm64
steps:
- name: Create release bot token
id: release-bot
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.PUTIO_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.PUTIO_RELEASE_BOT_PRIVATE_KEY }}
permission-contents: write
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.new_release_git_tag }}
persist-credentials: false
- name: Set up Vite+
uses: ./.github/actions/setup-vp
with:
node-version-file: ".node-version"
cache: false
- name: Install dependencies
run: vp install
- name: Build SEA binary
run: vp run build:sea
- name: Verify SEA binary
run: vp run verify:sea
- name: Package release assets
shell: pwsh
run: |
$version = "${{ needs.release.outputs.new_release_version }}"
$assetBase = "putio-cli-$version-${{ matrix.asset_os }}-${{ matrix.asset_arch }}"
$releaseDir = ".artifacts/release"
New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
$binaryPath = ".artifacts/sea/putio"
$stageDir = "$releaseDir/stage"
New-Item -ItemType Directory -Force -Path $stageDir | Out-Null
Copy-Item $binaryPath "$stageDir/putio"
tar -czf "$releaseDir/$assetBase.tar.gz" -C $stageDir putio
Remove-Item -Recurse -Force $stageDir
$assetPath = "$releaseDir/$assetBase.tar.gz"
$hash = (Get-FileHash -Algorithm SHA256 $assetPath).Hash.ToLower()
"$hash $(Split-Path $assetPath -Leaf)" | Out-File "$assetPath.sha256" -Encoding ascii -NoNewline
- name: Generate SHA-256 checksums
shell: pwsh
run: Get-ChildItem .artifacts/release
- name: Upload binary assets to the GitHub release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
with:
token: ${{ steps.release-bot.outputs.token }}
tag_name: ${{ needs.release.outputs.new_release_git_tag }}
files: |
.artifacts/release/*
build-windows-binary:
if: needs.release.outputs.new_release_published == 'true'
name: Build windows-latest release assets
needs:
- release
runs-on: windows-latest
timeout-minutes: 30
environment:
name: release
deployment: false
permissions:
contents: read
steps:
- name: Create release bot token
id: release-bot
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.PUTIO_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.PUTIO_RELEASE_BOT_PRIVATE_KEY }}
permission-contents: write
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.new_release_git_tag }}
persist-credentials: false
- name: Set up Vite+
uses: ./.github/actions/setup-vp
with:
node-version-file: ".node-version"
cache: false
- name: Install dependencies
run: vp install
- name: Build SEA binary
run: vp run build:sea
- name: Verify SEA binary
run: vp run verify:sea
- name: Package release assets
shell: pwsh
run: |
$version = "${{ needs.release.outputs.new_release_version }}"
$assetBase = "putio-cli-$version-windows-amd64"
$releaseDir = ".artifacts/release"
New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
$binaryPath = ".artifacts/sea/putio.exe"
Compress-Archive -Path $binaryPath -DestinationPath "$releaseDir/$assetBase.zip" -Force
$assetPath = "$releaseDir/$assetBase.zip"
$hash = (Get-FileHash -Algorithm SHA256 $assetPath).Hash.ToLower()
"$hash $(Split-Path $assetPath -Leaf)" | Out-File "$assetPath.sha256" -Encoding ascii -NoNewline
- name: Generate SHA-256 checksums
shell: pwsh
run: Get-ChildItem .artifacts/release
- name: Upload binary assets to the GitHub release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
with:
token: ${{ steps.release-bot.outputs.token }}
tag_name: ${{ needs.release.outputs.new_release_git_tag }}
files: |
.artifacts/release/*
update-homebrew-tap:
if: needs.release.outputs.new_release_published == 'true'
name: Update Homebrew tap
needs:
- release
- build-unix-binaries
runs-on: ubuntu-latest
timeout-minutes: 20
environment:
name: release
deployment: false
permissions:
contents: read
steps:
- name: Release to Homebrew tap
uses: Justintime50/homebrew-releaser@a62d7a359683bfc047cdb2431f53ee58241464d1 # v3
with:
homebrew_owner: putdotio
homebrew_tap: homebrew-tap
github_token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
commit_owner: devsputio
commit_email: devs@put.io
branch: main
formula_folder: Formula
install: 'bin.install "putio"'
test: |
output = shell_output("#{bin}/putio version")
assert_match "putio", output
assert_match version.to_s, output
target_darwin_arm64: true
target_linux_amd64: true
skip_checksum: true