|
1 | 1 | ## Releasing |
2 | 2 |
|
3 | | -### Feature branches |
| 3 | +This repo makes use of the [changesets](https://github.com/changesets/changesets) package to manage changelog generation, and publishing, and pushing appropriate github tags. |
| 4 | +## What is a `changeset`? |
| 5 | +> "A changeset is an intent to release a set of packages at particular semver bump types with a summary of the changes made." |
4 | 6 |
|
5 | | -Feature branches are automatically released under: |
| 7 | +Read: [An introduction to using changesets](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md). |
6 | 8 |
|
7 | | -- `http://cdn.segment.com/analytics-next/br/<branch>/<latest|sha>/standalone.js.gz` |
8 | 9 |
|
9 | | -### Production |
10 | 10 |
|
11 | | -Once you have tested your changes and they have been approved for a new release, merge your pull request and follow the steps: |
12 | 11 |
|
13 | | -- `make release` |
14 | | - > creates a release tag that is then compiled and published in CI |
| 12 | + |
| 13 | +To see what changes are going into the next release, run: |
| 14 | +``` |
| 15 | +yarn changeset info |
| 16 | +``` |
| 17 | +To test what the changelog will look like beforehand (locally), you can run: |
| 18 | +```bash |
| 19 | +export GITHUB_TOKEN="???" |
| 20 | +yarn changeset version |
| 21 | +``` |
| 22 | +(see https://github.com/settings/tokens) |
| 23 | + |
| 24 | +Once you have tested your changes and they have been approved for a new release, merge the changeset pull request into master. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +## How releasing works |
| 29 | +1. As PRs are merged into master, we use a [special GitHub action](https://github.com/changesets/action) to updates the package versions and changelogs, automatically creating a `Versions Packages` PR. |
| 30 | +2. Once we're ready to publish a new release, we can look at the `Version Packages` PR. If we like the way the Changelog looks, we can merge it in right there. If we want to edit the generated changelog, we can edit the changelog directly on that PR and then merge. If we aren't ready to merge things in and we want to add more detail to a changeset, we can always edit the changeset in .changesets/* and merge those in. Changesets are just text files, and are meant to be human-editable. |
| 31 | + |
| 32 | +### Releasing is handled for us by the [Release GitHub Action](/.github/workflows/release.yml). |
| 33 | + |
| 34 | +As PRs are opened against `master`, this action will open and update a PR which generates the appropriate `CHANGELOG.md` entries and `package.json` version bumps. |
| 35 | +The generated PR has the title "Version Packages" |
| 36 | + |
| 37 | +Once ready for a release, approve the "Version Packages" PR and merge it into `master`. |
| 38 | + |
| 39 | +## FAQ |
| 40 | + |
| 41 | +### How do I publish packages to npm / create a new release? |
| 42 | +1. Merge the `Version Packages` PR. |
| 43 | + |
| 44 | +### What does merging in `Version Packages` PR do under the hood? |
| 45 | +Information is in the [@changesets automation instructions](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md#how-do-i-run-the-version-and-publish-commands) |
| 46 | + |
| 47 | +### How does the changeset bot and changeset github action work? |
| 48 | +[Check out the @changesets automation instructions](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md#automating-changesets) |
| 49 | + |
| 50 | + |
| 51 | +### I don't want to use automation, how do I manually create a release? |
| 52 | + |
| 53 | +```bash |
| 54 | +export GITHUB_TOKEN="???" ## changelog generator requirement (https://github.com/settings/tokens) |
| 55 | + |
| 56 | +yarn update-versions-and-changelogs && ## bump + generate changelog + delete old changesets |
| 57 | +git add . && # add generated artifacts |
| 58 | +git commit -m "v1.X.X" && |
| 59 | +yarn release && ### run prepublish scripts + publish all packages to npm |
| 60 | +git push --follow-tags ### push generated tags to git (e.g @segment/analytics-next@1.X.X) |
| 61 | +``` |
| 62 | + |
| 63 | +### Feature branches |
| 64 | + |
| 65 | +Feature branches are automatically released under: |
| 66 | + |
| 67 | +- `http://cdn.segment.com/analytics-next/br/<branch>/<latest|sha>/standalone.js.gz` |
0 commit comments