Skip to content

Commit 3ed9c0d

Browse files
committed
chore: factor release note checking into separate script
1 parent 0fafcd8 commit 3ed9c0d

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -o nounset
4+
set -o pipefail
5+
set -o errexit
6+
7+
set -x
8+
9+
TAG=${1:-}
10+
if [ -n "$TAG" ]; then
11+
# If the workflow checks out one commit, but is releasing another
12+
git fetch origin tag "$TAG"
13+
# Update our local state so the grep command below searches what we expect
14+
git checkout "$TAG"
15+
fi
16+
17+
grep_exit_code=0
18+
# Exclude dot directories, specifically, this file so that we don't
19+
# find the substring we're looking for in our own file.
20+
# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings.
21+
grep --exclude=CONTRIBUTING.md \
22+
--exclude=RELEASING.md \
23+
--exclude=release.py \
24+
--exclude=release_test.py \
25+
--exclude-dir=.* \
26+
VERSION_NEXT_ -r || grep_exit_code=$?
27+
28+
if [[ $grep_exit_code -eq 0 ]]; then
29+
echo
30+
echo "Found VERSION_NEXT markers indicating version needs to be specified"
31+
exit 1
32+
fi

.github/workflows/create_archive_and_notes.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ git fetch origin tag "$TAG"
2929
# Update our local state so the grep command below searches what we expect
3030
git checkout "$TAG"
3131

32-
# Exclude dot directories, specifically, this file so that we don't
33-
# find the substring we're looking for in our own file.
34-
# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings.
35-
grep --exclude=CONTRIBUTING.md \
36-
--exclude=RELEASING.md \
37-
--exclude=release.py \
38-
--exclude=release_test.py \
39-
--exclude-dir=.* \
40-
VERSION_NEXT_ -r || grep_exit_code=$?
41-
42-
if [[ $grep_exit_code -eq 0 ]]; then
43-
echo
44-
echo "Found VERSION_NEXT markers indicating version needs to be specified"
45-
exit 1
46-
fi
47-
4832
# A prefix is added to better match the GitHub generated archives.
4933
PREFIX="rules_python-${TAG}"
5034
ARCHIVE="rules_python-$TAG.tar.gz"

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
uses: actions/checkout@v6
4444
with:
4545
ref: ${{ github.ref_name }}
46+
- name: Check version markers
47+
run: .github/workflows/check_version_markers.sh ${{ inputs.tag_name || github.ref_name }}
4648
- name: Create release archive and notes
4749
run: .github/workflows/create_archive_and_notes.sh ${{ inputs.tag_name || github.ref_name }}
4850
- name: Release

0 commit comments

Comments
 (0)