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
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ jobs:
uses: changesets/action@v1
with:
version: npm run version
publish: npm run release
publish: npm run release:v2
title: "chore(new-release)"
commit: "chore(new-release)"
branch: v2
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.STACKS_TOOLING_GH_RW_PAT }}
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ npm run test:watch -w packages/stacks-svelte
```

# Releasing Stacks
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).
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).

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

- 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).
- 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).
- 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)
- 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.
- 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).
- 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`.
- 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.
- V2 maintenance releases must not move npm's `latest` dist-tag. The current-generation release branch owns `latest`.

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

Expand Down
6 changes: 5 additions & 1 deletion adrs/0006-automatic-library-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ The automated release PRs created by changesets include a changelog entry for ea

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.

#### Maintenance release lines

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.

### Other tools considered

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

## Additional info

- [Changesets repository](https://github.com/changesets/changesets)
- [Changesets repository](https://github.com/changesets/changesets)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"prepublishOnly": "npm run build -workspaces -if-present",
"version": "changeset version && npm install --package-lock-only",
"release": "npm run build && changeset publish",
"release:v2": "npm run build && changeset publish --tag v2",
"format": "npm run format -workspaces -if-present",
"lint": "npm run lint -workspaces -if-present",
"start": "npm run start -w packages/stacks-docs",
Expand Down
Loading