Skip to content

Commit 4cb48b0

Browse files
committed
chore: verify bootstrap version format before merge
Relates-to: keymanapp/keyman.com#794 Test-bot: skip
1 parent e4fc409 commit 4cb48b0

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
if [ ! -f ./metadata/kmwversions.json ]; then
5353
echo "Failed to generate static file"
5454
exit 1
55-
fi
55+
fi
5656
#
5757
# If any of the tests fail, let's grab a bit more detail on the environment
5858
#
@@ -63,3 +63,16 @@ jobs:
6363
CONTAINER=`docker container ls -l -q`
6464
echo "--- PHP errors in Docker log ---"
6565
docker container logs $CONTAINER 2>&1 | grep 'php7'
66+
67+
- name: Verify .bootstrap-required-version
68+
if: ${{ !cancelled() }}
69+
shell: bash
70+
run: |
71+
# We want to avoid merging a bootstrap version that is not based on a published tag
72+
# in the shared-sites repo. We will do this with a heuristic based on the normal
73+
# shape of the tags, which is `v#.#.#`. Any other shape we will assume is a test
74+
# branch.
75+
cat resources/.bootstrap-required-version | grep -qP '^v\d+\.\d+\.\d+$' || (
76+
echo "::error file=resources/.bootstrap-required-version,line=1,col=1::This branch cannot be merged, because resources/.bootstrap-required-version references \`$(cat resources/.bootstrap-required-version)\`, which does not appear to be a published tag -- is it a test branch?"
77+
exit 1
78+
)

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
## START STANDARD SITE BUILD SCRIPT INCLUDE
33
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
44
readonly BOOTSTRAP="$(dirname "$THIS_SCRIPT")/resources/bootstrap.inc.sh"
5-
readonly BOOTSTRAP_VERSION=v1.0.13
5+
BOOTSTRAP_VERSION="$(cat "$(dirname "THIS_SCRIPT")/resources/.bootstrap-required-version")" || exit 1
6+
readonly BOOTSTRAP_VERSION
67
if ! [ -f "$BOOTSTRAP" ] || ! source "$BOOTSTRAP"; then
78
curl -H "Cache-Control: no-cache" --fail --silent --show-error -w "curl: Finished attempt to download %{url}" "https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh" -o "$BOOTSTRAP.tmp" || exit 1
89
source "$BOOTSTRAP.tmp"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.0.14

0 commit comments

Comments
 (0)