Fix package registry publish: use correct API v1 endpoint for deletion
Some checks failed
Release / build-and-release (push) Failing after 26m30s
Some checks failed
Release / build-and-release (push) Failing after 26m30s
The DELETE was using the upload URL instead of the API v1 package endpoint, so old versions were never actually deleted, causing 409 on re-upload and leaving stale latest.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
457dbce6c2
commit
e3992298f0
1 changed files with 7 additions and 9 deletions
|
|
@ -198,20 +198,18 @@ jobs:
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
API_URL="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/simpl-resultat/latest"
|
PKG_API="${GITHUB_SERVER_URL}/api/v1/packages/${GITHUB_REPOSITORY_OWNER}/generic/simpl-resultat/latest"
|
||||||
# Always delete the old version first to avoid 409 conflicts
|
UPLOAD_URL="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/simpl-resultat/latest"
|
||||||
|
|
||||||
|
# Delete the old package version via API v1 to avoid 409 conflicts
|
||||||
echo "Deleting old package version (if any)..."
|
echo "Deleting old package version (if any)..."
|
||||||
curl -s -X DELETE \
|
curl -s -X DELETE \
|
||||||
"${API_URL}/latest.json" \
|
"${PKG_API}" \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" || true
|
|
||||||
# Delete the package version itself to allow re-upload
|
|
||||||
DELETE_URL="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/simpl-resultat/latest"
|
|
||||||
curl -s -X DELETE \
|
|
||||||
"${DELETE_URL}" \
|
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" || true
|
-H "Authorization: token ${FORGEJO_TOKEN}" || true
|
||||||
|
|
||||||
echo "Uploading latest.json to package registry..."
|
echo "Uploading latest.json to package registry..."
|
||||||
HTTP_CODE=$(curl -w "%{http_code}" -X PUT \
|
HTTP_CODE=$(curl -w "%{http_code}" -X PUT \
|
||||||
"${API_URL}/latest.json" \
|
"${UPLOAD_URL}/latest.json" \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
--data-binary "@release-assets/latest.json" \
|
--data-binary "@release-assets/latest.json" \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue