Skip to content

Commit 8c7f0d1

Browse files
committed
ci: Don't allow releasing from non-master
1 parent ce83121 commit 8c7f0d1

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/release.yaml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,39 @@ jobs:
4949
name: Haskell Debugger Docs
5050
path: dist-newstyle/haskell-debugger*docs.tar.gz
5151

52+
validate-tag:
53+
name: Validate tag is at master HEAD
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Ensure tag points to master HEAD
61+
shell: bash
62+
run: |
63+
echo "Tag ref: $GITHUB_REF"
64+
echo "Tag commit: $GITHUB_SHA"
65+
66+
# Fetch latest master explicitly
67+
git fetch origin master
68+
69+
MASTER_SHA=$(git rev-parse origin/master)
70+
echo "origin/master HEAD: $MASTER_SHA"
71+
72+
if [[ "$GITHUB_SHA" != "$MASTER_SHA" ]]; then
73+
echo "Tag does not point to the tip of master."
74+
echo "Tag SHA: $GITHUB_SHA"
75+
echo "Master SHA: $MASTER_SHA"
76+
exit 1
77+
fi
78+
79+
echo "Tag is exactly at master HEAD."
80+
5281
release:
53-
# only release from a tag pointing to master!
54-
if: github.ref == 'refs/heads/master'
5582
name: Release
5683
runs-on: ubuntu-latest
57-
needs: [build-haskell-debugger, docs-haskell-debugger]
84+
needs: [validate-tag, build-haskell-debugger, docs-haskell-debugger]
5885
steps:
5986
- uses: actions/checkout@v4
6087
with:

0 commit comments

Comments
 (0)