-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (213 loc) · 7.26 KB
/
ci.yml
File metadata and controls
247 lines (213 loc) · 7.26 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
name: CI
on:
pull_request:
push:
branches:
- main
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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@v6
with:
fetch-depth: 0
- name: Set up Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: ".node-version"
cache: true
- 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
permissions:
contents: write
issues: write
pull-requests: 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: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: ".node-version"
cache: true
- name: Build package
run: vp pack
- name: Release package
id: semantic
uses: cycjimmy/semantic-release-action@v6
with:
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/npm
@semantic-release/github
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: devsputio
GIT_AUTHOR_EMAIL: devs@put.io
GIT_COMMITTER_NAME: devsputio
GIT_COMMITTER_EMAIL: devs@put.io
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
permissions:
contents: write
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: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check out release tag
run: git checkout ${{ needs.release.outputs.new_release_git_tag }}
- name: Set up Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: ".node-version"
cache: true
- 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@v2
with:
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
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check out release tag
run: git checkout ${{ needs.release.outputs.new_release_git_tag }}
- name: Set up Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: ".node-version"
cache: true
- 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@v2
with:
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
permissions:
contents: read
steps:
- name: Release to Homebrew tap
uses: Justintime50/homebrew-releaser@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