Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,25 @@ lsif-java snapshot-lsif # from github.com/sourcegraph/lsif-java

## Publishing a release

First, make sure you are on the main branch and have no dirty changes.

Next, run the `dev/bump-version` script to bump the version in package.json and
push a git tag to trigger a CI job.
First, make sure you have no dirty changes. Then run the `dev/bump-version`
script. It creates a `release/vX.Y.Z` branch from the latest `main`, bumps the
version in package.json, pushes the branch and opens a release PR.

```
./dev/bump-version VERSION_TO_RELEASE
# example: ./dev/bump-version 2.3.1
```

Once the release PR is merged, tag the merge commit on `main` and push the tag
to trigger the release job (use the name of your remote for
sourcegraph/scip-typescript instead of `origin` if it differs):

```
git fetch origin main
git show origin/main:package.json | grep '"version"' # should show the new version
git tag -a v2.3.1 -m "Version 2.3.1" origin/main
git push origin v2.3.1
```

Once the release job has finished, create a GitHub release
https://github.com/sourcegraph/scip-typescript/releases/new
41 changes: 27 additions & 14 deletions dev/bump-version
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
#!/usr/bin/env bash
set -eux

# Assert that current branch is main
git rev-parse --abbrev-ref HEAD | grep -q main

# Assert that there are no uncommitted changes
git diff-index --quiet HEAD --
# Creates a release PR that bumps the version in package.json.
# After the PR is merged, tag the merge commit to trigger the release job
# (see Development.md).

NEW_VERSION="$1"
if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "You need to specify a version number in the format X.Y.Z"
exit 1
fi

# Assert that there are no uncommitted changes
git diff-index --quiet HEAD --

# The remote pointing at sourcegraph/scip-typescript (override with REMOTE=...)
REMOTE="${REMOTE:-$(git remote -v | awk '$2 ~ /[:\/]sourcegraph\/scip-typescript(\.git)?$/ && $3 == "(push)" { print $1; exit }')}"
if [[ -z "$REMOTE" ]]; then
echo "No git remote for sourcegraph/scip-typescript found, set REMOTE=..."
exit 1
fi

BRANCH="release/v$NEW_VERSION"
git fetch "$REMOTE" main
git switch -c "$BRANCH" "$REMOTE/main"

echo "Updating package.json."
yarn version --no-git-tag-version --new-version "$NEW_VERSION"
git commit -am "Release v$NEW_VERSION." --allow-empty

# Commit and tag new version
VERSION_TAG="v$NEW_VERSION"
git add .
git commit -m "Bump version to $VERSION_TAG" --allow-empty
git push origin main
git tag -af "$VERSION_TAG" -m "Version $NEW_VERSION"
git push -f origin "$VERSION_TAG"
git commit -am "Release v$NEW_VERSION."

git push -u "$REMOTE" "$BRANCH"
gh pr create --repo sourcegraph/scip-typescript --base main --head "$BRANCH" \
--title "Release v$NEW_VERSION." \
--body "Bumps the version to $NEW_VERSION.

### Test plan

Version bump only. Once merged, pushing the \`v$NEW_VERSION\` tag triggers the release workflow."
Loading