ci: Release-Workflow baut vorhandene Tags auf Wunsch (workflow_dispatch), deploy-srv04.sh holt das Release aus Gitea (#1067)
All checks were successful
ci / pruefen (push) Successful in 1m16s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3bfByVgQ9z7CGCSGc
This commit is contained in:
2026-11-16 10:49:21 +01:00
parent 25113ea3a4
commit a671444ec1
3 changed files with 56 additions and 19 deletions

View File

@ -1,5 +1,9 @@
# Release-Binary bei einem Tag `v*` (→ #1067): das statische musl-Binary wird hier einmal gebaut und mit
# SHA-256-Prüfsumme an das Gitea-Release gehängt. Von Hand ausgelöst (workflow_dispatch) wird nur gebaut, nichts veröffentlicht.
# Release-Binary (→ #1067): das statische musl-Binary wird hier einmal gebaut und mit SHA-256-Prüfsumme an das
# Gitea-Release gehängt.
# - Push eines Tags `v*`: baut den Code dieses Tags und veröffentlicht.
# - Von Hand (workflow_dispatch) mit Eingabe `tag`: baut den Code dieses vorhandenen Tags (mit dem Workflow des
# gewählten Branches) und veröffentlicht; so lassen sich ältere Tags nachliefern, ohne sie zu verschieben.
# - Von Hand ohne `tag`: nur bauen, nichts veröffentlichen.
# Bewusst KEIN Auslöser `pull_request` (öffentliches Repository, Runner mit Docker-Socket).
name: release
@ -8,12 +12,27 @@ on:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Vorhandener Tag, der gebaut und veröffentlicht wird (z. B. v0.1.7); leer = nur bauen'
required: false
jobs:
binary:
runs-on: nexus
steps:
- name: Tag bestimmen
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
run: |
TAG="${INPUT_TAG:-}"
if [ -z "$TAG" ] && [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then TAG="$GITHUB_REF_NAME"; fi
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "Tag: ${TAG:-<keiner, nur bauen>}"
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Werkzeuge installieren
run: |
@ -30,21 +49,20 @@ jobs:
run: |
BIN=target/x86_64-unknown-linux-musl/release/nexus
VERSION="$("$BIN" version | awk '{print $2}')"
echo "Gebaut: nexus $VERSION"
if [ "${GITHUB_REF_TYPE:-}" = "tag" ] && [ "v$VERSION" != "$GITHUB_REF_NAME" ]; then
echo "Version im Binary ($VERSION) passt nicht zum Tag ($GITHUB_REF_NAME)" >&2; exit 1
echo "Gebaut: nexus $VERSION (Commit $(git rev-parse --short HEAD))"
if [ -n "$TAG" ] && [ "v$VERSION" != "$TAG" ]; then
echo "Version im Binary ($VERSION) passt nicht zum Tag ($TAG)" >&2; exit 1
fi
mkdir -p dist
cp "$BIN" "dist/nexus-$VERSION-linux-x86_64-musl"
(cd dist && sha256sum "nexus-$VERSION-linux-x86_64-musl" > "nexus-$VERSION-linux-x86_64-musl.sha256" && cat ./*.sha256)
- name: Release veröffentlichen
if: github.ref_type == 'tag'
if: env.TAG != ''
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
run: |
TAG="$GITHUB_REF_NAME"
ID="$(curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])' 2>/dev/null || true)"
if [ -z "$ID" ]; then
ID="$(curl -sf -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \