update ci
Build & Release binary / build (push) Canceled after 10m49s

This commit is contained in:
2026-08-15 02:39:02 +05:00
parent 548f7f3eb8
commit b2609cebc7
2 changed files with 15 additions and 10 deletions
+13 -7
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
#
# Create a Gitea release for a tag and upload everything in out/.
# Create a Gitea release and upload everything in out/.
# Mirrors the repo's existing Gitea-API release convention.
#
# Config via env (or a local .env next to this script):
# GITEA_SERVER_URL, GITEA_REPOSITORY, GITEA_TOKEN
# Tag: passed as $1 (in CI: gitea.ref_name), else derived from the current commit.
# GITEA_SERVER_URL, GITEA_REPOSITORY, PAT_GITEA
# Tag: $1 if given, else the tag on HEAD, else derived as v<server-version>-<shortsha>.
#
set -euo pipefail
cd "$(dirname "$0")"
@@ -15,17 +15,23 @@ cd "$(dirname "$0")"
: "${GITEA_SERVER_URL:?}"
: "${GITEA_REPOSITORY:?}"
: "${GITEA_TOKEN:?}"
: "${PAT_GITEA:?}"
ROOT="$(git rev-parse --show-toplevel)"
# Resolve a release tag:
TAG="${1:-$(git tag --points-at HEAD | head -n1)}"
[ -n "$TAG" ] || { echo "No tag (pass as arg, or run on a tagged commit)"; exit 1; }
if [ -z "$TAG" ]; then
VER="$(jq -r .version "$ROOT/httptoolkit-server/package.json")"
TAG="v${VER}-$(git rev-parse --short HEAD)"
fi
OUT_DIR="$(pwd)/out"
API="${GITEA_SERVER_URL}/api/v1/repos/${GITEA_REPOSITORY}/releases"
echo "==> Creating release $TAG"
RESP=$(curl -s -X POST "$API" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Authorization: token ${PAT_GITEA}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"${TAG}\", \"name\": \"HTTP Toolkit ${TAG}\", \"body\": \"Self-hosted single-file build.\"}")
@@ -41,7 +47,7 @@ for f in "$OUT_DIR"/*; do
name=$(basename "$f")
echo "==> Uploading $name"
curl -s -X POST "${API}/${RID}/assets?name=${name}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Authorization: token ${PAT_GITEA}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${f}" > /dev/null
done