Skip to content

Commit 9319c44

Browse files
Add RELEASE.md and CHANGELOG.md automation (#553)
This adds a RELEASE.md file that describes the release process in detail, and also adds automation for updating the CHANGELOG in the release workflow to reduce manual steps. Now, the publish workflow will create two commits: one will update the CHANGELOG, swapping out "Unreleased" for the new tag, and adding a new "Unreleased" section above it. It commits those changes, then continues on to `npm run package <version>`, which creates another commit, which are both pushed directly to `main`.
1 parent 7435058 commit 9319c44

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
git config --global user.email "256439237+app-token-vscode-buf-release[bot]@users.noreply.github.com"
4343
git config --global user.name "app-token-vscode-buf-release[bot]"
4444
git config --global url."https://x-access-token:${{ steps.generate_gh_token.outputs.token }}@github.com/bufbuild/vscode-buf".insteadOf "https://github.com/bufbuild/vscode-buf"
45+
make updatechangelog VERSION=${{ github.event.release.tag_name }}
46+
git add CHANGELOG.md
47+
git commit -m "Update CHANGELOG.md to version ${{ github.event.release.tag_name }}"
4548
npm run package ${{ github.event.release.tag_name }}
4649
git push https://x-access-token:${{ steps.generate_gh_token.outputs.token }}@github.com/${{ github.repository }}.git HEAD:${{ github.event.repository.default_branch }}
4750
@@ -51,6 +54,9 @@ jobs:
5154
git config --global user.email "256439237+app-token-vscode-buf-release[bot]@users.noreply.github.com"
5255
git config --global user.name "app-token-vscode-buf-release[bot]"
5356
git config --global url."https://x-access-token:${{ steps.generate_gh_token.outputs.token }}@github.com/bufbuild/vscode-buf".insteadOf "https://github.com/bufbuild/vscode-buf"
57+
make updatechangelog VERSION=${{ github.event.release.tag_name }}
58+
git add CHANGELOG.md
59+
git commit -m "Update CHANGELOG.md to version ${{ github.event.release.tag_name }}"
5460
npm run package:prerelease ${{ github.event.release.tag_name }}
5561
git push https://x-access-token:${{ steps.generate_gh_token.outputs.token }}@github.com/${{ github.repository }}.git HEAD:${{ github.event.repository.default_branch }}
5662

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
.DEFAULT_GOAL := package
22

3+
UNAME_OS := $(shell uname -s)
4+
5+
ifeq ($(UNAME_OS),Darwin)
6+
# Explicitly use the "BSD" sed shipped with Darwin. Otherwise if the user has a
7+
# different sed (such as gnu-sed) on their PATH this will fail in an opaque
8+
# manner. /usr/bin/sed can only be modified if SIP is disabled, so this should
9+
# be relatively safe.
10+
SED_I := /usr/bin/sed -i ''
11+
endif
12+
ifeq ($(UNAME_OS),Linux)
13+
SED_I := sed -i
14+
endif
15+
16+
317
.PHONY: package
418
package:
519
npm run package
620

721
.PHONY: install
822
install:
923
npm install
24+
25+
# This target is used in ./.github/workflows/publish.yaml;
26+
# do not change it without updating the callsite there.
27+
.PHONY: updatechangelog
28+
updatechangelog:
29+
ifndef VERSION
30+
$(error VERSION is required. Usage: make updatechangelog VERSION=1.0.0)
31+
endif
32+
@echo "Updating CHANGELOG.md with version $(VERSION)..."
33+
$(SED_I) 's/^## Unreleased$$/## Unreleased\n\n## $(VERSION)/' CHANGELOG.md
34+
@echo "Done! CHANGELOG.md updated."

RELEASE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Releasing vscode-buf
2+
3+
This document outlines how to create a release of vscode-buf.
4+
5+
The VS Code extension is published to both [Microsoft’s Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=bufbuild.vscode-buf) and [Open VSX](https://open-vsx.org/extension/bufbuild/vscode-buf).
6+
7+
1. Make sure all dependencies are upgraded, and that CI on `main` is green.
8+
9+
2. Ensure the [CHANGELOG](./CHANGELOG.md) reflects the state of the world;
10+
look through the commits between now and the latest release to ensure all user-facing changes are reflected.
11+
12+
3. Using the GitHub UI, create a new release.
13+
- Under “Choose a tag”, type in “X.Y.Z” to create a new tag for the release upon publish.
14+
- _Important_: Do not include a "v" prefix on the version.
15+
- _Important_: VS Code Marketplace requires a non-prerelease semver version (e.g., `1.0.0-rc1` is disallowed).
16+
Use a non-prerelease semver version even if you plan to tick the "set as a pre-release" box.
17+
- Target the main branch.
18+
- Title the Release “X.Y.Z”.
19+
- Click “set as latest release”.
20+
- Set the last version as the “Previous tag”.
21+
- Copy in the release notes from the CHANGELOG.md "Unreleased" section.
22+
- If any edits need to be made, you can save the release as a draft, make a PR to edit the CHANGELOG, and then copy in the new changes.
23+
24+
4. Publish the release.
25+
The ["Publish Extension" workflow](./.github/workflows/publish.yaml) will take care of updating the CHANGELOG and package.json to the given version.

0 commit comments

Comments
 (0)