ci: link published Composer packages to this repository #11

Merged
haylan merged 4 commits from ci/link-package-fix into main 2026-09-21 18:40:29 +00:00
Showing only changes of commit 61b4b2b1af - Show all commits
+12
View File
@@ -21,8 +21,10 @@ jobs:
run: |
set -e
VERSION=$(grep -m1 '"version"' composer.json | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
PACKAGE_NAME=$(grep -m1 '"name"' composer.json | sed -E 's/.*"name"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
TAG="v${VERSION}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "package_name=${PACKAGE_NAME}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q "${TAG}"; then
echo "skip=true" >> "$GITHUB_OUTPUT"
@@ -98,3 +100,13 @@ jobs:
echo "Unexpected HTTP status $STATUS publishing to the Composer registry"
exit 1
fi
- name: Link Composer package to this repository
if: steps.version.outputs.skip == 'false'
run: |
ENCODED_NAME=$(printf '%s' "${{ steps.version.outputs.package_name }}" | sed 's#/#%2F#g')
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u "haylan:${{ secrets.RELEASE_TOKEN }}" -X POST "https://git.arthurerlich.de/api/v1/packages/haylan/composer/${ENCODED_NAME}/-/link/AeonDumpManager")
echo "link status: $STATUS"
if [ "$STATUS" != "201" ]; then
echo "::warning::Failed to link the Composer package to this repository (HTTP $STATUS) - not fatal, release already published"
fi