Skip to content

Commit 3f64cc1

Browse files
authored
fix(release): publish V2 packages under v2 tag (#2374)
1 parent 955c993 commit 3f64cc1

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ jobs:
6969
uses: changesets/action@v1
7070
with:
7171
version: npm run version
72-
publish: npm run release
72+
publish: npm run release:v2
7373
title: "chore(new-release)"
7474
commit: "chore(new-release)"
75+
branch: v2
7576
createGithubReleases: true
7677
env:
7778
GITHUB_TOKEN: ${{ secrets.STACKS_TOOLING_GH_RW_PAT }}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,15 @@ npm run test:watch -w packages/stacks-svelte
175175
```
176176

177177
# Releasing Stacks
178-
This repo uses [Semantic Versioning](https://semver.org/) to distribute Stacks Classic and Stacks Docs via [npm](https://www.npmjs.com/package/@stackoverflow/stacks), and publishes [release notes on Github](https://github.com/StackExchange/Stacks/releases).
178+
This repo uses [Semantic Versioning](https://semver.org/) to distribute Stacks Classic and Stacks Svelte via npm, and publishes [release notes on GitHub](https://github.com/StackExchange/Stacks/releases).
179179

180180
We use [changesets](https://github.com/changesets/changesets) to automatize the steps necessary to publish to NPM, create GH releases and a changelog.
181181

182-
- Every time you do work that requires a new release to be published, [add a changesets entry](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) by running `npx chageset` and follow the instructions on screen. (changes that do not require a new release - e.g. changing a test file - don’t need a changeset).
182+
- Every time you do work that requires a new release to be published, [add a changesets entry](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) by running `npx changeset` and follow the instructions on screen. (changes that do not require a new release - e.g. changing a test file - don’t need a changeset).
183183
- When opening a PR without a corresponding changeset the [changesets-bot](https://github.com/apps/changeset-bot) will remind you to do so. It generally makes sense to have one changeset for PR (if the PR changes do not require a new release to be published the bot message can be safely ignored)
184-
- The [release github workflow](.github/workflows/release.yml) continuosly check if there are new pending changesets in the main branch, if there are it creates a GH PR (`chore(release)` [see example](https://github.com/StackExchange/apca-check/pull/2)) and continue updating it as more changesets are potentially pushed/merged to the main branch.
185-
- When we are ready to cut a release we need to simply merge the `chore(release)` PR back to main and the release github workflow will take care of publishing the changes to NPM and create a GH release for us. The `chore(release)` PR also give us an opportunity to adjust the automatically generated changelog when necessary (the entry in the changelog file is also what will end up in the GH release notes).
184+
- The [CI workflow](.github/workflows/main.yml) continuously checks for pending changesets on the `v2` branch. When changesets are present, it creates or updates the `changeset-release/v2` pull request targeting `v2`.
185+
- When we are ready to cut a V2 maintenance release, merge the release pull request into `v2`. The workflow publishes the packages to npm under the `v2` dist-tag and creates versioned Git tags and GitHub releases. The release pull request also gives us an opportunity to adjust the automatically generated changelog when necessary.
186+
- V2 maintenance releases must not move npm's `latest` dist-tag. The current-generation release branch owns `latest`.
186187

187188
_The release github workflow only run if the CI workflow (running linter, formatter and tests) is successful: CI is blocking accidental releases_.
188189

adrs/0006-automatic-library-release.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ The automated release PRs created by changesets include a changelog entry for ea
4242

4343
Release PRs generated by changesets can be used in conjunction with GitHub Actions to automatically publish a package to npm when the PR is merged. See the [GitHub Action currently in use in the axe-apca repository](https://github.com/StackExchange/apca-check/blob/main/.github/workflows/release.yml) for a real-world example.
4444

45+
#### Maintenance release lines
46+
47+
The `v2` branch remains available for supported Stacks Classic 2.x and Stacks Svelte 0.7.x maintenance releases. Changesets generates release pull requests against `v2`, and published packages use npm's `v2` dist-tag. The current-generation release branch owns npm's `latest` dist-tag, so a later V2 patch release must not replace the current major version for unversioned installs.
48+
4549
### Other tools considered
4650

4751
#### [standard-version](https://github.com/conventional-changelog/standard-version)
@@ -58,4 +62,4 @@ Release PRs generated by changesets can be used in conjunction with GitHub Actio
5862

5963
## Additional info
6064

61-
- [Changesets repository](https://github.com/changesets/changesets)
65+
- [Changesets repository](https://github.com/changesets/changesets)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"prepublishOnly": "npm run build -workspaces -if-present",
1313
"version": "changeset version && npm install --package-lock-only",
1414
"release": "npm run build && changeset publish",
15+
"release:v2": "npm run build && changeset publish --tag v2",
1516
"format": "npm run format -workspaces -if-present",
1617
"lint": "npm run lint -workspaces -if-present",
1718
"start": "npm run start -w packages/stacks-docs",

0 commit comments

Comments
 (0)