ci: Gitea Actions を手動ビルド専用ワークフローに整理

- build-release.yml(タグ時の Releases 公開)を削除
- build-package.yml を追加: workflow_dispatch のみで ocis linux/amd64 をビルドし、
  バイナリと sha256 を Actions の Artifact(7 日間)に保存
- runs-on を ubuntu-latest に変更
This commit is contained in:
sylph committed 2026-11-01 16:02:12 +09:00
1 parent d76d421fc6
commit d466cb205c
1 file changed
+8 -38
@@ -1,20 +1,17 @@
name: Build & Release (Reverse Cloud)
name: Build Package (Reverse Cloud)
# 省エネ方針: ブランチへの push や PR では実行しない。
# 手動実行(workflow_dispatch)と v* タグの push のときだけ実行する。
# 手動実行専用。ビルドして Actions の Artifact(7 日間)に保存する。
# push / PR / タグでは実行しない。
on:
workflow_dispatch:
inputs:
version:
description: 'バージョン(空欄なら 0.0.0-dev.<短縮SHA>)'
description: 'パッケージのバージョン(空欄なら 0.0.0-dev.<短縮SHA>)'
required: false
default: ''
push:
tags:
- 'v*'
concurrency:
group: build-release-${{ github.ref }}
group: build-package-${{ github.ref }}
cancel-in-progress: true
env:
@@ -24,7 +21,7 @@ env:
jobs:
build:
runs-on: ubuntu-26.04
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
@@ -37,9 +34,7 @@ jobs:
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
VERSION="${GITHUB_REF_NAME#v}"
elif [[ -n "${INPUT_VERSION}" ]]; then
if [[ -n "${INPUT_VERSION}" ]]; then
VERSION="${INPUT_VERSION#v}"
else
VERSION="0.0.0-dev.$(git rev-parse --short HEAD)"
@@ -82,7 +77,6 @@ jobs:
run: make ci-go-generate
- name: Build ocis (linux/amd64, static PIE)
id: build
shell: bash
env:
CGO_ENABLED: '0'
@@ -97,33 +91,9 @@ jobs:
(cd dist && sha256sum "$(basename "${OUT}")" > "$(basename "${OUT}").sha256")
ls -lh dist
- name: Upload artifact (manual run)
if: github.event_name == 'workflow_dispatch'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ocis-${{ steps.ver.outputs.version }}-linux-amd64
path: dist/
retention-days: 7
- name: Publish Gitea release (tag push)
if: github.ref_type == 'tag'
shell: bash
env:
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITEA_TOKEN }}
run: |
set -euo pipefail
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
TAG="${GITHUB_REF_NAME}"
AUTH=(-H "Authorization: token ${TOKEN}")
if ! RID=$(curl -sf "${AUTH[@]}" "${API}/releases/tags/${TAG}" | jq -er .id); then
PRE=false; [[ "${TAG}" == *-* ]] && PRE=true
RID=$(jq -n --arg t "${TAG}" --argjson p "${PRE}" \
'{tag_name: $t, name: ("Reverse Cloud " + $t), prerelease: $p}' \
| curl -sf "${AUTH[@]}" -H 'Content-Type: application/json' -d @- "${API}/releases" \
| jq -er .id)
fi
for f in dist/*; do
name=$(basename "${f}")
curl -sf "${AUTH[@]}" -F "attachment=@${f}" "${API}/releases/${RID}/assets?name=${name}" > /dev/null
echo "uploaded ${name}"
done