Fix v0.1.7 release workflow
This commit is contained in:
1 parent
bcc8b07d1e
commit
e061d374ba
2 files changed
+24
-18
No files matched your search
@@ -2,8 +2,6 @@ name: Build and release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
@@ -49,10 +47,6 @@ jobs:
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
|
||||
- name: Typecheck frontend
|
||||
working-directory: frontend
|
||||
run: npm run typecheck
|
||||
|
||||
- name: Build frontend
|
||||
working-directory: frontend
|
||||
run: npm run build
|
||||
@@ -98,14 +92,14 @@ jobs:
|
||||
|
||||
build_release \
|
||||
x86_64-unknown-linux-musl \
|
||||
pixhelf-amd64 \
|
||||
pixhelf-amd64-linux \
|
||||
'Advanced Micro Devices X86-64'
|
||||
build_release \
|
||||
aarch64-unknown-linux-musl \
|
||||
pixhelf-arm64 \
|
||||
pixhelf-arm64-linux \
|
||||
AArch64
|
||||
|
||||
dist/pixhelf-amd64 --help >/dev/null
|
||||
dist/pixhelf-amd64-linux --help >/dev/null
|
||||
|
||||
- name: Prepare release metadata
|
||||
if: startsWith(forgejo.ref, 'refs/tags/v')
|
||||
@@ -166,14 +160,26 @@ jobs:
|
||||
--header "Authorization: token ${token}" \
|
||||
"${api}/repos/${repository}/releases/${release_id}/assets"
|
||||
|
||||
for asset in dist/pixhelf-amd64 dist/pixhelf-arm64; do
|
||||
asset_name="$(basename "$asset")"
|
||||
existing="$(ASSETS_JSON="$assets_json" ASSET_NAME="$asset_name" node -e \
|
||||
delete_asset() {
|
||||
asset_name="$1"
|
||||
asset_id="$(ASSETS_JSON="$assets_json" ASSET_NAME="$asset_name" node -e \
|
||||
'const assets = JSON.parse(require("fs").readFileSync(process.env.ASSETS_JSON)); const found = assets.find((asset) => asset.name === process.env.ASSET_NAME); process.stdout.write(found ? String(found.id) : "")')"
|
||||
if [ -n "$existing" ]; then
|
||||
echo "Release asset already exists: ${asset_name}"
|
||||
continue
|
||||
if [ -z "$asset_id" ]; then
|
||||
return
|
||||
fi
|
||||
curl --silent --show-error --fail \
|
||||
--request DELETE \
|
||||
--header "Authorization: token ${token}" \
|
||||
"${api}/repos/${repository}/releases/${release_id}/assets/${asset_id}"
|
||||
echo "Deleted existing release asset: ${asset_name}"
|
||||
}
|
||||
|
||||
delete_asset pixhelf-amd64
|
||||
delete_asset pixhelf-arm64
|
||||
|
||||
for asset in dist/pixhelf-amd64-linux dist/pixhelf-arm64-linux; do
|
||||
asset_name="$(basename "$asset")"
|
||||
delete_asset "$asset_name"
|
||||
curl --silent --show-error --fail \
|
||||
--request POST \
|
||||
--header "Authorization: token ${token}" \
|
||||
|
||||
@@ -31,11 +31,11 @@ cargo build --release
|
||||
|
||||
发布工作流使用 musl 静态链接,并在同一台 AMD64 构建机上交叉编译两个版本:
|
||||
|
||||
- `pixhelf-amd64`:`x86_64-unknown-linux-musl`
|
||||
- `pixhelf-arm64`:`aarch64-unknown-linux-musl`
|
||||
- `pixhelf-amd64-linux`:`x86_64-unknown-linux-musl`
|
||||
- `pixhelf-arm64-linux`:`aarch64-unknown-linux-musl`
|
||||
|
||||
两个 Release 产物都是无扩展名的独立可执行文件,下载后需要执行
|
||||
`chmod +x pixhelf-amd64` 或 `chmod +x pixhelf-arm64`。
|
||||
`chmod +x pixhelf-amd64-linux` 或 `chmod +x pixhelf-arm64-linux`。
|
||||
|
||||
## 参数
|
||||
|
||||
|
||||
Reference in new issue
Block a user