Skip to content

Commit 5556301

Browse files
bjorn3squell
authored andcommitted
Fetch tags earlier in the release workflow
1 parent bceee7e commit 5556301

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ jobs:
1515

1616
- name: Sanity checks
1717
run: |
18+
# GHA makes the tag point to the commit rather than the tag object.
19+
# Remove the tag and fetch it again to get the real tag object.
20+
git tag -d "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')"
21+
git fetch https://github.com/trifectatechfoundation/sudo-rs.git --tags
22+
1823
# Check if the tag has a signature to prevent accidentally pushing an unsigned tag.
1924
git tag -l --format='%(contents:signature)' "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')" | grep --quiet SIGNATURE || (echo "Tag not signed"; exit 1)
2025
@@ -32,11 +37,6 @@ jobs:
3237
3338
- name: Compare checksums
3439
run: |
35-
# GHA makes the tag point to the commit rather than the tag object.
36-
# Remove the tag and fetch it again to get the real tag object.
37-
git tag -d "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')"
38-
git fetch https://github.com/bjorn3/sudo-rs.git --tags
39-
4040
# Get the expected checksums from the tag message.
4141
git tag -l --format='%(contents:body)' "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')" | tr -s '\n' > expected_checksums.txt
4242
@@ -69,14 +69,20 @@ jobs:
6969
7070
# Extract the first changelog entry from CHANGELOG.md
7171
echo "Changelog:"
72-
sed -n '4,${ /^## /q; p; }' CHANGELOG.md
72+
sed -n '4,${ /^## /q; p; }' CHANGELOG.md | tee changes.md
7373
7474
- name: Create release
7575
env:
7676
GH_TOKEN: ${{ github.token }}
7777
run: |
78-
gh release create "$GITHUB_REF" --draft \
79-
--title "Version $(echo "$GITHUB_REF" | sed 's/refs\/tags\///')" \
78+
# GHA makes the tag point to the commit rather than the tag object.
79+
# Remove the tag and fetch it again to get the real tag object.
80+
RELEASE="$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')"
81+
git tag -d "$RELEASE"
82+
git fetch https://github.com/trifectatechfoundation/sudo-rs.git --tags
83+
84+
gh release create "$RELEASE" --draft \
85+
--title "Version ${RELEASE#v}" \
8086
--notes-file changes.md release_files/* \
8187
--verify-tag
8288
echo "Draft release successfully created. Please review and publish."

0 commit comments

Comments
 (0)