Skip to content

Commit 241bea7

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

File tree

3 files changed

+47
-16
lines changed

3 files changed

+47
-16
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2023 The Bazel Authors. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o nounset
17+
set -o pipefail
18+
set -o errexit
19+
20+
set -x
21+
22+
TAG=${1:-}
23+
if [ -n "$TAG" ]; then
24+
# If the workflow checks out one commit, but is releasing another
25+
git fetch origin tag "$TAG"
26+
# Update our local state so the grep command below searches what we expect
27+
git checkout "$TAG"
28+
fi
29+
30+
grep_exit_code=0
31+
# Exclude dot directories, specifically, this file so that we don't
32+
# find the substring we're looking for in our own file.
33+
# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings.
34+
grep --exclude=CONTRIBUTING.md \
35+
--exclude=RELEASING.md \
36+
--exclude=release.py \
37+
--exclude=release_test.py \
38+
--exclude-dir=.* \
39+
VERSION_NEXT_ -r || grep_exit_code=$?
40+
41+
if [[ $grep_exit_code -eq 0 ]]; then
42+
echo
43+
echo "Found VERSION_NEXT markers indicating version needs to be specified"
44+
exit 1
45+
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)