Skip to content

Commit 549359b

Browse files
committed
Simplify release script to avoid access to GITHUB_TOKEN
1 parent 5836494 commit 549359b

File tree

2 files changed

+16
-41
lines changed

2 files changed

+16
-41
lines changed

dev/bump-version

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,22 @@
11
#!/usr/bin/env bash
2-
set -eu
2+
set -eux
33

4-
if [ -z "$1" ]; then
5-
echo "Missing version argument; this script should be invoked as:"
6-
echo "$ ./dev/bump-version M.N.P"
7-
exit 1
8-
fi
4+
# Assert that current branch is main
5+
git rev-parse --abbrev-ref HEAD | grep -q main
96

10-
if [ -z "$GITHUB_TOKEN" ]; then
11-
echo "Missing GitHub Token environment variable."
12-
exit 1
13-
fi
7+
# Assert that there are no uncommitted changes
8+
git diff-index --quiet HEAD --
149

15-
echo "Updating package.json."
16-
yarn version --no-git-tag-version --new-version $1
17-
echo "Updating CHANGELOG.md."
18-
npx github-changes --only-pulls --branch main --owner sourcegraph --repository scip-typescript --tag-name "v$1" --token "$GITHUB_TOKEN"
19-
20-
# HACK: github-changes doesn't seem to have a good way to get a delta since
21-
# a particular tag to a _future_ tag; the --between-tags argument expects
22-
# that the second tag in the range to already exist, whereas what we want
23-
# to do here is first merge the ChangeLog and then add the new tag.
24-
25-
# ✅ -f, -n and -s are supported on GNU csplit and BSD csplit.
26-
csplit -f CL -n 1 -s CHANGELOG.md '/### v0.1.17/'
27-
28-
# ✅ -i<ext> works on both GNU sed and BSD sed.
29-
# See https://stackoverflow.com/a/22084103/2682729
30-
sed -i.bak -e 's/scip-typescript/lsif-typescript/g' CL1 && rm CL1.bak
31-
32-
cat CL0 CL1 > CHANGELOG.md && rm CL0 CL1
10+
NEW_VERSION="$1"
3311

34-
yarn run prettier
12+
echo "Updating package.json."
13+
yarn version --no-git-tag-version --new-version "$NEW_VERSION"
14+
git commit -am "Release v$NEW_VERSION."
3515

16+
# Commit and tag new version
17+
VERSION_TAG="v$NEW_VERSION"
3618
git add .
37-
TITLE="Update ChangeLog and bump version for releasing $1."
38-
git commit -m "$TITLE"
39-
40-
gh pr create --base main --title "$TITLE" --body '
41-
### Test plan
42-
43-
Ran automated tests.'
44-
45-
echo "-------------------------------------------------------------------------"
46-
echo "Don't forget to push a version tag v$1 to main once the PR is merged!"
47-
echo "-------------------------------------------------------------------------"
19+
git commit -m "Bump version to $VERSION_TAG" --allow-empty
20+
git push origin main
21+
git tag -af "$VERSION_TAG" -m "Version $NEW_VERSION"
22+
git push -f origin "$VERSION_TAG"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sourcegraph/scip-typescript",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"description": "SCIP indexer for TypeScript and JavaScript",
55
"publisher": "sourcegraph",
66
"bin": "dist/src/main.js",

0 commit comments

Comments
 (0)