From ea00334ded42e43fd8c5e5eb208fa48e62e4110d Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sat, 14 Feb 2026 22:53:51 -0600 Subject: [PATCH] fix(#1): add package linking step to CI pipeline Links the published npm package to the telemetry-client-js repository in Gitea so it appears on the repo's Packages tab. Co-Authored-By: Claude Opus 4.6 --- .woodpecker.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index cf910b1..d458a3c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -81,3 +81,38 @@ steps: event: [push, manual, tag] depends_on: - build + + link-package: + image: alpine:3 + environment: + GITEA_TOKEN: + from_secret: gitea_token + commands: + - apk add --no-cache curl + - | + set -e + PKG="%40mosaicstack%2Ftelemetry-client" + for attempt in 1 2 3; do + STATUS=$$(curl -s -o /tmp/link-response.txt -w "%{http_code}" -X POST \ + -H "Authorization: token $$GITEA_TOKEN" \ + "https://git.mosaicstack.dev/api/v1/packages/mosaic/npm/$$PKG/-/link/telemetry-client-js") + if [ "$$STATUS" = "201" ] || [ "$$STATUS" = "204" ]; then + echo "Package linked to repository" + exit 0 + elif [ "$$STATUS" = "400" ]; then + echo "Package already linked (OK)" + exit 0 + elif [ $$attempt -lt 3 ]; then + echo "Status $$STATUS, retrying in 5s (attempt $$attempt/3)..." + sleep 5 + else + echo "FAILED to link package (status $$STATUS)" + cat /tmp/link-response.txt + exit 1 + fi + done + when: + - branch: [main, develop] + event: [push, manual, tag] + depends_on: + - publish