@@ -1,16 +1,42 @@
1−#!/usr/bin/env nix-shell
2−#!nix-shell -i bash
1+#!/usr/bin/env bash
32
4−set -euxo pipefail
3+set -euo pipefail
54
65# Please use this script to cut new releases. It will generate a new tag name
76# based on the current date, update the latest releases file, and push the tag
87
9−# TODO: fail if there's a tag with this same name, as sometimes we publish more than one per day
8+# Fail if we are not on trunk
9+BRANCH=$(git branch --show-current)
10+if [ "${BRANCH}" != "master" ]; then
11+ echo "Please checkout master branch";
12+ exit 1;
13+fi
14+git pull
15+
16+LATEST_PURS="0.14.4"
17+
18+NEW_STABLE_TAG="psc-${LATEST_PURS}"
19+
20+# Create the first tag for the compiler if it doesn't exist
21+if git rev-parse "${NEW_STABLE_TAG}" >/dev/null 2>&1; then
22+ echo "Stable tag '${NEW_STABLE_TAG}' already exists, skipping";
23+else
24+ echo "Creating and pushing new tag '${NEW_STABLE_TAG}'.."
25+ git tag "${NEW_STABLE_TAG}";
26+ git push origin "${NEW_STABLE_TAG}";
27+fi
1028
11−LATEST_PURS="0.14.3"
1229NEW_TAG="psc-${LATEST_PURS}-`date +'%Y%m%d'`"
1330
31+# Fail if the new tag already exists
32+# Note: exit status of the command is the conditional
33+if git rev-parse "${NEW_TAG}" >/dev/null 2>&1; then
34+ echo "Tag '${NEW_TAG}' already exists!";
35+ exit 1;
36+fi
37+
38+echo "Creating and pushing new tag '${NEW_TAG}'.."
39+
1440./update-latest-compatible-sets.sh "${NEW_TAG}"
1541
1642git add latest-compatible-sets.json
@@ -22,3 +48,5 @@ git push
2248git tag "${NEW_TAG}"
2349
2450git push origin "${NEW_TAG}"
51+
52+echo "Done."