fix(#1): add package linking step to CI pipeline
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user