generated from CubeCraft-Creations/Tracehound
ci: publish dev release via Node (runner has no curl/jq/sudo)
The build-dev publish step failed with exit 127 — the act runner image is minimal (no curl, jq, or sudo; runs as root). Node is always present (setup-node), so do the release publish in Node using built-in fetch/crypto and FormData/Blob for the asset upload. No external tools needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,31 +42,11 @@ jobs:
|
||||
# Pull-based deploy: publish the binary to a rolling "dev" release.
|
||||
# The Pi polls this release and self-updates (scripts/pi-update.sh);
|
||||
# the runner never needs to reach the closed RemoteRig network.
|
||||
# Done in Node (runner image has no curl/jq/sudo; Node is present).
|
||||
- name: Publish to rolling dev release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SERVER: ${{ github.server_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if ! command -v jq >/dev/null; then sudo apt-get update -qq && sudo apt-get install -y -qq jq; fi
|
||||
API="$SERVER/api/v1/repos/$REPO"
|
||||
AUTH="Authorization: token $TOKEN"
|
||||
VERSION="${SHA:0:8}"
|
||||
echo "$VERSION" > version.txt
|
||||
sha256sum "$BINARY_NAME" | awk '{print $1}' > "$BINARY_NAME.sha256"
|
||||
|
||||
# Roll the "dev" release forward to this commit (delete old release + tag).
|
||||
REL_ID=$(curl -sf -H "$AUTH" "$API/releases/tags/dev" | jq -r '.id // empty' || true)
|
||||
[ -n "$REL_ID" ] && curl -sf -X DELETE -H "$AUTH" "$API/releases/$REL_ID" || true
|
||||
curl -sf -X DELETE -H "$AUTH" "$API/tags/dev" || true
|
||||
|
||||
REL_ID=$(curl -sf -X POST -H "$AUTH" -H "Content-Type: application/json" "$API/releases" \
|
||||
-d "{\"tag_name\":\"dev\",\"target_commitish\":\"$SHA\",\"name\":\"dev ($VERSION)\",\"body\":\"Rolling dev build $SHA\",\"prerelease\":true}" \
|
||||
| jq -r '.id')
|
||||
|
||||
for f in "$BINARY_NAME" "$BINARY_NAME.sha256" version.txt; do
|
||||
curl -sf -X POST -H "$AUTH" -F "attachment=@$f" "$API/releases/$REL_ID/assets?name=$f"
|
||||
done
|
||||
echo "Published dev release $VERSION"
|
||||
run: node .gitea/scripts/publish-release.mjs
|
||||
Reference in New Issue
Block a user