Skip to content

Commit d0467f3

Browse files
committed
always fetch latest tags in check-latest-tag, use scratch dir
1 parent 8be9505 commit d0467f3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.buildkite/check-latest-tag.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/usr/bin/env bash
22

3+
scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
4+
function finish() {
5+
rm -rf "$scratch"
6+
}
7+
trap finish EXIT
8+
39
set -ex
410

511
cd "$(dirname "${BASH_SOURCE[0]}")"/..
612

713
get_latest() {
14+
git fetch --tags
15+
816
git tag |
917
# drop `v` prefix
1018
grep "^v" |
@@ -22,10 +30,10 @@ get_latest() {
2230

2331
latest="$(get_latest)"
2432

25-
git grep --line-number "# LATEST" examples >want.txt
26-
git grep --line-number "\"$latest\" # LATEST" examples >got.txt
33+
git grep --line-number "# LATEST" examples >"$scratch/want.txt" || true
34+
git grep --line-number "\"$latest\" # LATEST" examples >"$scratch/got.txt" || true
2735

28-
if ! git diff --no-index --exit-code want.txt got.txt; then
36+
if ! git diff --no-index --exit-code "$scratch/want.txt" "$scratch/got.txt"; then
2937
echo ""
3038
echo "❌ Detected old versions! Make sure that all versions \`version = \"...\" # LATEST\` match the latest git tag: $latest"
3139
exit 1

0 commit comments

Comments
 (0)