Skip to content

Commit 9076146

Browse files
cli: Streamline release workflow for v0.2.2 (#104)
1 parent f7b38f0 commit 9076146

File tree

4 files changed

+84
-3
lines changed

4 files changed

+84
-3
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ChangeLog
2+
3+
## v0.2.2
4+
5+
### Additions
6+
7+
- The new `scip print` subcommand can be used to view a SCIP index without access to protoc. (https://github.com/sourcegraph/scip/pull/91)
8+
- 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)
9+
10+
### Fixes
11+
12+
- `scip --version` now works as expected instead of reporting 0.1.0. (https://github.com/sourcegraph/scip/pull/97)

Development.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ PACKAGE=MY_PACKAGE_NAME SRC_ACCESS_TOKEN=MY_TOKEN SRC_ENDPOINT=https://sourcegra
8787

8888
## Release a new version
8989

90-
[Create a new release](https://github.com/sourcegraph/scip/releases/new)
91-
in the web UI (or using the `gh` CLI), along with any release notes.
90+
First, add release notes to the [CHANGELOG](CHANGELOG.md).
91+
Next, update the version in `cmd/version.txt`.
92+
93+
After landing a commit with those two changes, run the release script:
94+
(requires the [GitHub CLI](https://cli.github.com/))
95+
96+
```bash
97+
NEW_VERSION="M.N.P" ./dev/publish-release.sh
98+
```
99+
92100
Once the release is created, the artifacts will be built and uploaded
93101
automatically by the [release action](/.github/workflows/release.yml).

cmd/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.1
1+
0.2.2

dev/publish-release.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
{
6+
if [ -z "${NEW_VERSION:-}" ]; then
7+
echo "error: Missing value for environment variable NEW_VERSION"
8+
echo "hint: Invoke this script as NEW_VERSION=M.N.P ./tools/scripts/publish-scip-ruby.sh"
9+
exit 1
10+
fi
11+
12+
if ! grep -q "## v$NEW_VERSION" CHANGELOG.md; then
13+
echo "error: Missing CHANGELOG entry for v$NEW_VERSION"
14+
echo "note: CHANGELOG entries are required for publishing releases"
15+
exit 1
16+
fi
17+
18+
if ! grep -q "$NEW_VERSION" cmd/version.txt; then
19+
echo "error: SCIP version in cmd/version.txt doesn't match NEW_VERSION=$NEW_VERSION"
20+
exit 1
21+
fi
22+
23+
if ! git diff --quiet; then
24+
echo "error: Found unstaged changes; aborting."
25+
exit 1
26+
fi
27+
28+
if ! git diff --quiet --cached; then
29+
echo "error: Found staged-but-uncommitted changes; aborting."
30+
exit 1
31+
fi
32+
33+
if ! git remote -v | grep "origin" | grep -q "https://github.com/sourcegraph/scip.git"; then
34+
echo "error: remote 'origin' doesn't point to sourcegraph/scip"
35+
exit 1
36+
fi
37+
38+
if ! git rev-parse --abbrev-ref HEAD | grep -q "main"; then
39+
echo "error: Releases should be published from main but HEAD is on a different branch" >&2
40+
exit 1
41+
fi
42+
} >&2
43+
44+
TAG="v$NEW_VERSION"
45+
git tag "$TAG"
46+
git push origin "$TAG"
47+
48+
{
49+
echo "See the [CHANGELOG](https://github.com/sourcegraph/scip/blob/main/CHANGELOG.md) to see what's new in scip v$NEW_VERSION."
50+
echo ''
51+
echo 'Download the CLI for your current platform using:'
52+
echo ''
53+
echo '```bash'
54+
echo 'env \'
55+
echo " TAG=\"v$NEW_VERSION\" \\"
56+
echo ' OS="$(uname -s | tr '\''[:upper:]'\'' '\''[:lower:]'\'')" \'
57+
echo ' ARCH="$(uname -m | sed -e '\''s/x86_64/amd64/'\'')" \'
58+
echo ' bash -c '\''curl -L "https://github.com/sourcegraph/scip/releases/download/$TAG/scip-$OS-$ARCH.tar.gz"'\'' \'
59+
echo '| tar xzf - scip'
60+
echo '```'
61+
} | gh release create --title "scip-ruby v$NEW_VERSION" --notes-file -

0 commit comments

Comments
 (0)