From ac17a954b01c1d7a945367788583b5fa62f5a4b4 Mon Sep 17 00:00:00 2001 From: "tao.chen" <93983997+taochen-ct@users.noreply.github.com> Date: Tue, 21 Jul 2026 18:57:18 +0800 Subject: [PATCH] ci: extract release script to fix YAML parse error (line 51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'Upload release assets via Gitea API' step embedded a JSON heredoc inside a YAML block scalar (run: |). Gitea's YAML parser bailed at line 51 with 'could not find expected :'' when it saw the leading '{' of the JSON body — it tried to interpret the heredoc content as a flow mapping instead of literal text. Fix: move the release logic into .github/scripts/create-release.sh and pass the GitHub Actions context values as env vars. The step becomes: env: GITEA_TOKEN: ... TAG_NAME: ... API_URL: ... REPOSITORY: ... SHA: ... run: ./.github/scripts/create-release.sh Validates cleanly with PyYAML (yaml.safe_load). Pattern matches bark-notify.sh from earlier — CI helpers live in .github/scripts/, workflows stay slim. Co-Authored-By: Claude --- .github/scripts/create-release.sh | 52 +++++++++++++++++++++++++++++++ .github/workflows/build.yml | 50 +++++------------------------ 2 files changed, 60 insertions(+), 42 deletions(-) create mode 100755 .github/scripts/create-release.sh diff --git a/.github/scripts/create-release.sh b/.github/scripts/create-release.sh new file mode 100755 index 0000000..9c1e052 --- /dev/null +++ b/.github/scripts/create-release.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# create-release.sh — create a Gitea release and attach dist/ assets. +# +# Required env vars (set by the workflow): +# GITEA_TOKEN Gitea API token with release write scope +# TAG_NAME tag name (e.g. v0.0.1-beta) +# API_URL Gitea API base URL (e.g. http://gitea.local/api/v1) +# REPOSITORY owner/repo +# SHA commit SHA the tag points at + +set -euo pipefail + +PAYLOAD=$(cat <