Skip to content

Commit dc6fc4d

Browse files
authored
Fix CI publish script's tag validation (linkedin#313)
Also port over fix from Rest.li making non-master publish error messages more clear and actionable.
1 parent c63fb70 commit dc6fc4d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/scripts/publish.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ if [ "$CI" != "true" ] || [ "$GITHUB_ACTIONS" != "true" ]; then
77
fi
88

99
# Ensure that the tag is named properly as a semver tag
10-
if [[ ! "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
11-
echo "Tag $TRAVIS_TAG is NOT a valid semver tag (vX.Y.Z), please delete this tag."
10+
if [[ ! "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
11+
echo "Tag $GITHUB_REF is NOT a valid semver tag (vX.Y.Z), please delete this tag."
1212
exit 1
1313
fi
1414

@@ -36,11 +36,15 @@ if [ "$GITHUB_REF" != "refs/tags/$EXPECTED_TAG" ]; then
3636
fi
3737

3838
# Ensure that the tag commit is an ancestor of master
39-
git fetch origin master:master
39+
git fetch origin master:master 2>&1 | head -n 10 # Truncate excessive fetch output
4040
git merge-base --is-ancestor $GITHUB_REF master
4141
if [ $? -ne 0 ]; then
4242
echo "Tag $GITHUB_REF is NOT an ancestor of master!"
43-
echo 'Please delete this tag and instead create a tag off a master commit.'
43+
echo 'Cannot publish ParSeq using a non-master commit, please delete this tag.'
44+
echo 'If you still want to publish, please run the release script using a master commit.'
45+
echo 'See below for guidance on how to properly use the release script:'
46+
echo ''
47+
cat ./scripts/help-text/release.txt
4448
exit 1
4549
fi
4650

@@ -66,7 +70,7 @@ else
6670

6771
echo 'Failed to publish to JFrog Artifactory.'
6872
echo "You can check https://linkedin.jfrog.io/ui/repos/tree/General/parseq to ensure that $VERSION is not present."
69-
echo 'Please retry the upload by restarting this Travis job.'
73+
echo 'Please retry the upload by restarting this GitHub Actions job.'
7074

7175
exit 1
7276
fi

0 commit comments

Comments
 (0)