Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: semantic release #746

Merged
merged 55 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
87f854f
chore: fix repo url field
kanadgupta Feb 10, 2023
266787d
chore(deps-dev): install semantic-release, initial config
kanadgupta Feb 10, 2023
73fce60
chore(deps-dev): add husky + commitlint
kanadgupta Feb 10, 2023
c8d995d
Merge branch 'main' into semantic-release
kanadgupta Feb 10, 2023
100f7fc
ci: add release.yml
kanadgupta Feb 10, 2023
076cfbf
feat: fix comment
kanadgupta Feb 10, 2023
5870124
chore: temporarily disable dryrun :meow-sweat:
kanadgupta Feb 10, 2023
ce4e494
fix: next channel
kanadgupta Feb 10, 2023
3eb52fd
fix: remove some of the package scripts
kanadgupta Feb 10, 2023
d8a722f
chore: restore dry runs
kanadgupta Feb 10, 2023
85e4bfd
feat: add git + changelog plugins
kanadgupta Feb 10, 2023
baa1705
chore(temp): disable dry-run
kanadgupta Feb 10, 2023
11799e1
build(release): ๐Ÿš€ v8.6.0-next.2 release ๐Ÿฆ‰
semantic-release-bot Feb 10, 2023
1ba8bdd
chore: little bits of cleanup
kanadgupta Feb 10, 2023
29b9ec6
fix: rebuild prior to npm publish
kanadgupta Feb 10, 2023
38c5625
fix: reformat github release header
kanadgupta Feb 11, 2023
836a9f2
build(release): ๐Ÿš€ v8.6.0-next.3 ๐Ÿฆ‰
semantic-release-bot Feb 11, 2023
bd2e1a2
fix: reformat header again
kanadgupta Feb 11, 2023
4c34207
feat: drop duplicative tag
kanadgupta Feb 11, 2023
523310f
build(release): ๐Ÿš€ v8.6.0-next.4 ๐Ÿฆ‰
semantic-release-bot Feb 11, 2023
05300e7
chore: remove github release npm script
kanadgupta Feb 13, 2023
f9fe6c6
Revert "feat: drop duplicative tag"
kanadgupta Feb 13, 2023
cac0c1d
fix: try rearranging steps like this
kanadgupta Feb 13, 2023
f0b241c
build(release): ๐Ÿš€ v8.6.0-next.5 ๐Ÿฆ‰
semantic-release-bot Feb 13, 2023
194489e
revert: don't set header for changelog
kanadgupta Feb 13, 2023
8463946
chore: add comment
kanadgupta Feb 13, 2023
e77b67a
Revert "chore: remove github release npm script"
kanadgupta Feb 13, 2023
1825c27
chore(deps-dev): install @semantic-release/exec
kanadgupta Feb 13, 2023
24f885e
fix: run tests but NOT release workflow on release commits
kanadgupta Feb 13, 2023
bb91531
chore: add another comment
kanadgupta Feb 13, 2023
8c343a0
fix: try this as an alternative to @semantic-release/github
kanadgupta Feb 13, 2023
533a2db
build(release): ๐Ÿš€ v8.6.0-next.6 ๐Ÿฆ‰
semantic-release-bot Feb 13, 2023
5f05aea
refactor: get rid of npm script
kanadgupta Feb 13, 2023
f277c47
chore: add comment
kanadgupta Feb 13, 2023
53dbd02
chore: remove another now-redundant npm script
kanadgupta Feb 13, 2023
7581049
chore: c'mon man
kanadgupta Feb 13, 2023
dda580e
docs: update MAINTAINERS.md
kanadgupta Feb 13, 2023
1b547dc
chore: cleanup
kanadgupta Feb 13, 2023
b067e01
chore: fix up a few GHA branch setups
kanadgupta Feb 13, 2023
b28c936
chore: remove a redundant rules
kanadgupta Feb 13, 2023
0b1e429
revert: ugh here we go again
kanadgupta Feb 13, 2023
4e5ecff
fix: try this approach to lifecycle events
kanadgupta Feb 13, 2023
f9f82f1
fix: turns out these rules weren't redundant
kanadgupta Feb 13, 2023
793de2b
build(release): ๐Ÿš€ v8.6.0-next.7 ๐Ÿฆ‰
semantic-release-bot Feb 13, 2023
c81e432
fix: does this work?
kanadgupta Feb 13, 2023
a211647
chore: cleanup + cache
kanadgupta Feb 13, 2023
05af285
build(release): ๐Ÿš€ v8.6.0-next.8 ๐Ÿฆ‰
semantic-release-bot Feb 13, 2023
c07495a
revert: bring workflow name back
kanadgupta Feb 13, 2023
df5f238
chore: use this convention instead
kanadgupta Feb 13, 2023
eec7a2e
chore: ok stop this now
kanadgupta Feb 13, 2023
c22889c
fix: remove unnecessary config
kanadgupta Feb 13, 2023
c9a2910
Merge branch 'next' into semantic-release
kanadgupta Feb 13, 2023
b04a8ce
Merge branch 'next' into semantic-release
kanadgupta Feb 14, 2023
1629acb
Merge branch 'next' into semantic-release
kanadgupta Feb 15, 2023
e15c574
fix: bad merge
kanadgupta Feb 15, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- next
pull_request:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: 'CodeQL'

on:
push:
branches: [main]
branches: [main, next]
pull_request:
branches: [main]
branches: [main, next]
schedule:
- cron: '0 12 * * 1'

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
branches:
- main
- next

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install dependencies and build TS
run: npm ci && npm run build
- name: Run semantic-release workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
30 changes: 30 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
branches:
- name: main
- name: next
prerelease: true
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- '@semantic-release/changelog'
# `npm` must be before `git` so the `npm` command can properly bump
# the package*.json files before we commit the changes
- '@semantic-release/npm'
- [
'@semantic-release/git',
{
# TODO: once docker builds are a thing, we're going to have to manually add the assets
# since we're also updating the action.yml file with every release!
# Uncomment this line below once those changes are live:
# assets: ['action.yml', 'CHANGELOG.md', 'package.json', 'package-lock.json'],
message: "build(release): ๐Ÿš€ v${nextRelease.version} ๐Ÿฆ‰\n\n${nextRelease.notes}\n[skip ci]",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
]
- [
'@semantic-release/exec',
{
# Adds a couple extra tags as aliases for our GitHub Actions users
'prepareCmd': 'git tag ${nextRelease.version} && ./bin/set-major-version-tag.js',
# Lightweight alternative to `@semantic-release/github` that creates a draft release
'publishCmd': 'gh release create ${nextRelease.version} --draft --generate-notes',
},
]
73 changes: 70 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
# [8.6.0-next.8](https://github.com/readmeio/rdme/compare/v8.6.0-next.7...v8.6.0-next.8) (2023-02-13)


### Bug Fixes

* does this work? ([c81e432](https://github.com/readmeio/rdme/commit/c81e43255e7208b2c6851e1c5702714256e5ec66))

# [8.6.0-next.7](https://github.com/readmeio/rdme/compare/v8.6.0-next.6...v8.6.0-next.7) (2023-02-13)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a few formatting discrepancies in this file now but I really care to be honest



### Bug Fixes

* try this approach to lifecycle events ([4e5ecff](https://github.com/readmeio/rdme/commit/4e5ecff0b2ebf7bf03d7e977fd2d0564bc255695))
* turns out these rules weren't redundant ([f9f82f1](https://github.com/readmeio/rdme/commit/f9f82f1b71a5182a9205ae807d92ae0ca2f6d25f))


### Reverts

* ugh here we go again ([0b1e429](https://github.com/readmeio/rdme/commit/0b1e42935011cb149fca89bc9ec096636628f6e8))

# [8.6.0-next.6](https://github.com/readmeio/rdme/compare/v8.6.0-next.5...v8.6.0-next.6) (2023-02-13)


### Bug Fixes

* run tests but NOT release workflow on release commits ([24f885e](https://github.com/readmeio/rdme/commit/24f885e00cf966d32cca013ca59aea903f9c3807))
* try this as an alternative to @semantic-release/github ([8c343a0](https://github.com/readmeio/rdme/commit/8c343a09bbfa62e2410705d480b91837ec2af854))


### Reverts

* Revert "chore: remove github release npm script" ([e77b67a](https://github.com/readmeio/rdme/commit/e77b67a0c03075e5a78de464ceb4873e1354579d))
* don't set header for changelog ([194489e](https://github.com/readmeio/rdme/commit/194489ee5382c0366606c7d62b45262783b91394))

## What's Changed

### Bug Fixes

* try rearranging steps like this ([cac0c1d](https://github.com/readmeio/rdme/commit/cac0c1df2b71d6e15b7c418628708d2490cc1986))


### Reverts

* Revert "feat: drop duplicative tag" ([f9fe6c6](https://github.com/readmeio/rdme/commit/f9fe6c6cf92cb944ac284b4bed4077e9d63662cc))

## What's Changed

### Bug Fixes

* reformat header again ([bd2e1a2](https://github.com/readmeio/rdme/commit/bd2e1a24122a2e40e0944eae638d02f205165fd9))


### Features

* drop duplicative tag ([4c34207](https://github.com/readmeio/rdme/commit/4c34207be6acf3b30b6f0b9e3b70722047f52403))

## What's Changed in 8.6.0-next.3

### Bug Fixes

* rebuild prior to npm publish ([29b9ec6](https://github.com/readmeio/rdme/commit/29b9ec6a38212882de22f9c3c4f35e5ce295f267))
* reformat github release header ([38c5625](https://github.com/readmeio/rdme/commit/38c5625bb2a22506953943a389f05ff70b39d659))

# [8.6.0-next.2](https://github.com/readmeio/rdme/compare/v8.6.0-next.1...v8.6.0-next.2) (2023-02-10)


### Features

* add git + changelog plugins ([85e4bfd](https://github.com/readmeio/rdme/commit/85e4bfd982d1b9d9193ccf2c5441eb6aa016b725))

## 8.5.0 (2023-02-01)

* docs: update outdated file names ([52a8219](https://github.com/readmeio/rdme/commit/52a8219))
Expand Down Expand Up @@ -1435,6 +1505,3 @@ Alongside this change, this release includes major documentation updates and sup
* version 0.1.2 ([349ba96](https://github.com/readmeio/rdme/commit/349ba96))
* Weight help items ([fffc107](https://github.com/readmeio/rdme/commit/fffc107))
* Whoops, fixing up api url and making it work ([da021fd](https://github.com/readmeio/rdme/commit/da021fd))



58 changes: 27 additions & 31 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
# Maintainers

This doc describes how to prep a release and publish to GitHub and `npm`.
This doc describes how releases are published to GitHub and `npm`.

## Prep the Release
## Automatic Packaging + Publishing ๐Ÿ“ฆ

Run the following command, where `<version>` is the version you wish to update the package to:
Nearly all of our release process is automated. In this section, we discuss everything that takes place!

```sh
npm run bump -- <version>
```
> **Note**
> You don't _need_ to know everything that takes place here, this is mostly for my own documentation purposes! But if you are tagging an actual release, there are a couple of outstanding steps that are described in [the next section](#one-more-thing-โ˜๏ธ) ๐Ÿ‘‡

This command will automatically bump the version in the `package.json` and the `package-lock.json` files, update [`CHANGELOG.md`](./CHANGELOG.md), and add the corresponding git tags.
When code is merged into the `main` or `next` branches, a release workflow (powered by [`semantic-release`](https://github.com/semantic-release/semantic-release)) automatically kicks off that does the following:

## Publishing to GitHub :octopus:
- All commit messages since the last release are analyzed to determine whether or not the new changes warrant a new release (i.e., if the changes are features or fixes as opposed to smaller housekeeping changes) ๐Ÿง
- Based on the changes, the version is bumped in [`package.json`](./package.json) with a new git tag ๐Ÿท๏ธ For example, say the current version is `8.5.1` and the commit history includes a new feature. This would result in a minor semver bump, which would produce the following tags:
- A release tag like `v8.6.0` if on the `main` branch
- A prerelease tag like `v8.6.0-next.1` if on the `next` branch
- A changelog is generated and appended to [`CHANGELOG.md`](./CHANGELOG.md) ๐Ÿชต
- A build commit (like [this](https://github.com/readmeio/rdme/commit/533a2db50b39c3b6130b3af07bebaed38218db4c)) is created with the updated `package*.json` and `CHANGELOG.md` files ๐Ÿ†•
- A couple duplicated tags are created for the current commit so our users can refer to them differently in their GitHub Actions (e.g., `8.6.0`, `v8`) ๐Ÿ”–
- The new commit and tags are pushed to GitHub ๐Ÿ“Œ
- The new version is published to the `npm` registry ๐Ÿš€ The package [distribution tag](https://docs.npmjs.com/adding-dist-tags-to-packages) will depend on which branch is being pushed to:
- If on the `main` branch, a version is pushed on the main distribution tag (a.k.a. `latest`, which is used when someone runs `npm i rdme` with no other specifiers).
- If on the `next` branch, the prerelease distribution tag (a.k.a. [`next`](https://www.npmjs.com/package/rdme/v/next)) is updated.
- A [GitHub release is created](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) for the tag (in draft form) ๐Ÿ™

The next step is to push these changes to GitHub:
## One more thing โ˜๏ธ

```sh
git push # pushes the code
git push --tags -f # pushes the tags
```
> **Note**
> The steps in this section are only required if you're building an actual release and not a prelease (i.e., changes are being merged into the `main` branch).

Once the code and tags are pushed to GitHub, [create a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) so the latest tag is surfaced in [the GitHub Marketplace listing](https://github.com/marketplace/actions/rdme-sync-to-readme).
While nearly all of our release process is automated, there are a couple quick steps remaining:

Make sure you have the [GitHub CLI](https://cli.github.com) installed and then run the following:
1. **Backport the changes in the `main` branch back into `next`** ๐Ÿ”™ you can do so by running the following:

```sh
npm run release:gh
git checkout next
git merge main
git push
```

This will create a draft release which you can enhance before publishing. I like to summarize the changes and note any highlights in a blurb above the auto-generated release notes. These release links are nice for sharing with customers, on socials, etc.

## Publishing to `npm` :rocket:

Finally, publish the changes to `npm`. If you're publishing to a non-standard [distribution tag](https://docs.npmjs.com/adding-dist-tags-to-packages) for prelease purposes or otherwise (e.g., `alpha`, `beta`, `next`, etc.), you can run the following:

```sh
npm publish --tag <tag>
```

If you're publishing to the default [distribution tag](https://docs.npmjs.com/adding-dist-tags-to-packages) (i.e., `latest`), you can omit the `--tag` flag like so:

```sh
npm publish
```
2. **Fluff out the GitHub release and publish it** โœ๏ธ the GitHub release is currently in draft form but it needs to be published so the latest version is surfaced to folks that discover our tool via [the GitHub Marketplace listing](https://github.com/marketplace/actions/rdme-sync-to-readme). I like to summarize the changes and note any highlights in a blurb above the auto-generated release notes. These release links are nice for sharing with customers, on socials, etc.
Loading