Files
MoShiro/ci/publish-linux-agent.sh
justme 490b008a57
ci/woodpecker/push/dev-image Pipeline is running
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline was successful
scripts: unify Linux native builds and retain restore caches [CI]
Build musl and glibc for amd64 and arm64 through one native package path. Reuse musl outputs for OCI images and OpenWrt installers, and export binaries inside a rootless unshare session.

Restore the executable dependency graph into a shared persistent NuGet cache, build managed dependencies once, and run isolated native publishes in parallel.

Clean temporary outputs and expired image layers under store locks, retire inactive legacy stores after seven days, and retain two toolchain exports. Add regression coverage for staging, extraction, packaging and cleanup boundaries.
2026-10-21 12:29:00 +08:00

33 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# Publish one Linux package. Installation feeds reuse this build's binaries.
set -euo pipefail
rid="${1:?usage: publish-linux-agent.sh <rid> <binaries>}"; binaries="${2:?}"
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$root/ci/version.sh"
[[ -n "${GITEA_TOKEN:-}" ]] || { echo 'GITEA_TOKEN is required' >&2; exit 2; }
if [[ -z "${CI_COMMIT_TAG:-}" ]]; then
bash "$root/ci/wait-for-checks.sh"
channel=dev
else
channel=release
fi
work="$root/.release/linux-agent/$rid/packages"
mkdir -p "$work"
chmod 700 "$work"
trap 'rm -f "$work/curl.conf"' EXIT
bash "$root/ci/package-linux-agent.sh" "$rid" "$binaries" "$work"
printf 'header = "Authorization: token %s"\n' "$GITEA_TOKEN" > "$work/curl.conf"
chmod 600 "$work/curl.conf"
base="${GITEA_BASE:-http://127.0.0.1:3100}"
for file in "$work"/*.tar.gz "$work"/*.sha256; do
code="$(curl --silent --show-error --retry 3 --config "$work/curl.conf" --upload-file "$file" \
--output "$work/response" --write-out '%{http_code}' \
"${base%/}/api/packages/justme/generic/moshiro-node/$MOSHIRO_VERSION/$(basename "$file")")"
[[ "$code" == 2* || "$code" == 409 ]] || { echo "Linux package upload failed: HTTP $code" >&2; exit 1; }
done
# This is an installation adapter, not a separate native build or image extraction.
# Preserve the installed OpenWrt updater's signed-feed contract.
if [[ "$rid" == linux-musl-* && -n "${RELEASE_SIGNING_KEY:-}" && ( "$channel" == dev || "$MOSHIRO_VERSION" != *-* ) ]]; then
bash "$root/ci/publish-openwrt.sh" "$channel" "$rid" "$binaries"
fi