Skip to content

Commit

Permalink
cli: Streamline release workflow for v0.2.2 (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
varungandhi-src authored Oct 6, 2022
1 parent f7b38f0 commit 9076146
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ChangeLog

## v0.2.2

### Additions

- The new `scip print` subcommand can be used to view a SCIP index without access to protoc. (https://github.com/sourcegraph/scip/pull/91)
- The new `scip lint` subcommand can be used to identify correctness and redundancy issues with a SCIP index. (https://github.com/sourcegraph/scip/pull/92)

### Fixes

- `scip --version` now works as expected instead of reporting 0.1.0. (https://github.com/sourcegraph/scip/pull/97)
12 changes: 10 additions & 2 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ PACKAGE=MY_PACKAGE_NAME SRC_ACCESS_TOKEN=MY_TOKEN SRC_ENDPOINT=https://sourcegra

## Release a new version

[Create a new release](https://github.com/sourcegraph/scip/releases/new)
in the web UI (or using the `gh` CLI), along with any release notes.
First, add release notes to the [CHANGELOG](CHANGELOG.md).
Next, update the version in `cmd/version.txt`.

After landing a commit with those two changes, run the release script:
(requires the [GitHub CLI](https://cli.github.com/))

```bash
NEW_VERSION="M.N.P" ./dev/publish-release.sh
```

Once the release is created, the artifacts will be built and uploaded
automatically by the [release action](/.github/workflows/release.yml).
2 changes: 1 addition & 1 deletion cmd/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
0.2.2
61 changes: 61 additions & 0 deletions dev/publish-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

set -euo pipefail

{
if [ -z "${NEW_VERSION:-}" ]; then
echo "error: Missing value for environment variable NEW_VERSION"
echo "hint: Invoke this script as NEW_VERSION=M.N.P ./tools/scripts/publish-scip-ruby.sh"
exit 1
fi

if ! grep -q "## v$NEW_VERSION" CHANGELOG.md; then
echo "error: Missing CHANGELOG entry for v$NEW_VERSION"
echo "note: CHANGELOG entries are required for publishing releases"
exit 1
fi

if ! grep -q "$NEW_VERSION" cmd/version.txt; then
echo "error: SCIP version in cmd/version.txt doesn't match NEW_VERSION=$NEW_VERSION"
exit 1
fi

if ! git diff --quiet; then
echo "error: Found unstaged changes; aborting."
exit 1
fi

if ! git diff --quiet --cached; then
echo "error: Found staged-but-uncommitted changes; aborting."
exit 1
fi

if ! git remote -v | grep "origin" | grep -q "https://github.com/sourcegraph/scip.git"; then
echo "error: remote 'origin' doesn't point to sourcegraph/scip"
exit 1
fi

if ! git rev-parse --abbrev-ref HEAD | grep -q "main"; then
echo "error: Releases should be published from main but HEAD is on a different branch" >&2
exit 1
fi
} >&2

TAG="v$NEW_VERSION"
git tag "$TAG"
git push origin "$TAG"

{
echo "See the [CHANGELOG](https://github.com/sourcegraph/scip/blob/main/CHANGELOG.md) to see what's new in scip v$NEW_VERSION."
echo ''
echo 'Download the CLI for your current platform using:'
echo ''
echo '```bash'
echo 'env \'
echo " TAG=\"v$NEW_VERSION\" \\"
echo ' OS="$(uname -s | tr '\''[:upper:]'\'' '\''[:lower:]'\'')" \'
echo ' ARCH="$(uname -m | sed -e '\''s/x86_64/amd64/'\'')" \'
echo ' bash -c '\''curl -L "https://github.com/sourcegraph/scip/releases/download/$TAG/scip-$OS-$ARCH.tar.gz"'\'' \'
echo '| tar xzf - scip'
echo '```'
} | gh release create --title "scip-ruby v$NEW_VERSION" --notes-file -

0 comments on commit 9076146

Please sign in to comment.