forked from alterminal/alterminal
fixup
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
# 發佈流程:push `v*` tag 或手動觸發(workflow_dispatch)時,交叉編譯各平台
|
||||
# 二進制並上傳到 Gitea Release。
|
||||
#
|
||||
# token 一律使用倉庫 secret `ACTION_TOKEN`(自架 runner 不保證有自動簽發的
|
||||
# github.token,故 checkout 與發佈皆明確指定),需具備本倉庫 contents 讀寫權限。
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: '要發佈的既有 tag(例如 v1.2.3)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# tag push 與手動觸發都 checkout 指定 tag 的 commit
|
||||
ref: ${{ inputs.tag || github.ref_name }}
|
||||
token: ${{ secrets.ACTION_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
# 自架 runner 的 cache server 未必可用,關閉以免誤失敗
|
||||
cache: false
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
|
||||
run: |
|
||||
set -eu
|
||||
echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
|
||||
VERSION="${RELEASE_TAG#v}"
|
||||
mkdir -p dist
|
||||
# chi/pgx 皆為純 Go,關閉 CGO 交叉編譯出靜態執行檔;模板與
|
||||
# Tailwind 產物已提交且以 go:embed 內嵌,不需 Node。
|
||||
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do
|
||||
os=${target%/*}
|
||||
arch=${target#*/}
|
||||
staging="dist/alterminal_${VERSION}_${os}_${arch}"
|
||||
mkdir -p "$staging"
|
||||
CGO_ENABLED=0 GOOS=$os GOARCH=$arch \
|
||||
go build -trimpath -ldflags='-s -w' -o "$staging/alterminal" ./cmd/alterminal
|
||||
tar -C "$staging" -czf "$staging.tar.gz" alterminal
|
||||
rm -rf "$staging"
|
||||
done
|
||||
(cd dist && sha256sum *.tar.gz > checksums.txt)
|
||||
ls -l dist
|
||||
|
||||
- name: Publish to release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.ACTION_TOKEN }}
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
name: ${{ env.RELEASE_TAG }}
|
||||
files: dist/*
|
||||
body: |
|
||||
### 下載
|
||||
|
||||
依平台下載對應的 `alterminal_<版本>_<os>_<arch>.tar.gz`,並以 `checksums.txt` 驗證 SHA-256。
|
||||
|
||||
為單一執行檔(模板與樣式已內嵌),設定 `DB_*` 環境變數後直接執行 `./alterminal`,部署細節見 README。
|
||||
Reference in New Issue
Block a user