fix(ci): the release step tolerates a release that already exists
A re-fired tag hits the release POST with a 409 and curl -sf turns "already exists" into a red job while the image jobs succeed — observed on boilerroom's v0.1.0 re-fires tonight; this workflow fails the same way. Check-then-create makes the step idempotent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,12 +10,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create Gitea Release
|
||||
# Idempotent: a re-fired tag finds its release already present and
|
||||
# says so instead of failing on the 409.
|
||||
run: |
|
||||
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
|
||||
auth='Authorization: token ${{ secrets.GITHUB_TOKEN }}'
|
||||
if curl -sf -H "$auth" "$api/tags/${{ github.ref_name }}" > /dev/null; then
|
||||
echo "release for ${{ github.ref_name }} already exists — nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "$auth" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"tag_name": "${{ github.ref_name }}", "name": "Release ${{ github.ref_name }}", "body": "Automated release for ${{ github.ref_name }}"}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
|
||||
"$api"
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user