Skip to content

Commit 02f440d

Browse files
committed
Try to make immutable releases work, help me God
1 parent 870e14a commit 02f440d

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,23 @@ jobs:
7373
done
7474
done
7575
76-
- name: Create or fetch release
76+
- name: Create immutable release
7777
env:
7878
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
TAG_NAME: ${{ github.ref_name }}
8079
run: |
8180
set -euo pipefail
82-
gh release view "$TAG_NAME" >/dev/null 2>&1 || gh release create "$TAG_NAME" --title "$TAG_NAME" --notes ""
81+
tag="${{ github.ref_name }}"
82+
if gh release view "$tag" >/dev/null 2>&1; then
83+
if [ "$(gh release view "$tag" --json isDraft --jq .isDraft)" = "true" ]; then
84+
echo "Draft release '$tag' already exists; uploading assets and publishing."
85+
gh release upload "$tag" dist/* --clobber
86+
gh release edit "$tag" --draft=false
87+
else
88+
echo "Release '$tag' already exists and is published; skipping."
89+
fi
90+
exit 0
91+
fi
8392
84-
- name: Upload release assets
85-
env:
86-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87-
TAG_NAME: ${{ github.ref_name }}
88-
run: |
89-
set -euo pipefail
90-
gh release upload "$TAG_NAME" dist/* --clobber
93+
gh release create "$tag" --draft --title "$tag" --notes ""
94+
gh release upload "$tag" dist/* --clobber
95+
gh release edit "$tag" --draft=false

0 commit comments

Comments
 (0)