diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 387369d004..661ea4b181 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/README.md b/README.md index a1bfd15fee..5d9878cf40 100755 --- a/README.md +++ b/README.md @@ -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_. diff --git a/adrs/0006-automatic-library-release.md b/adrs/0006-automatic-library-release.md index 89c0b44e4e..00062494d6 100644 --- a/adrs/0006-automatic-library-release.md +++ b/adrs/0006-automatic-library-release.md @@ -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) @@ -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) \ No newline at end of file +- [Changesets repository](https://github.com/changesets/changesets) diff --git a/package.json b/package.json index 5bb47edbca..b9ddb582f3 100644 --- a/package.json +++ b/package.json @@ -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",