Skip to content

Commit

Permalink
devtools: document and further automate release process (#112)
Browse files Browse the repository at this point in the history
* feat: version bump and changelog automation

* Automatically commit and open pr

* Add release docs

* Mention gh

* Remove reviewers
  • Loading branch information
Daniel authored Feb 18, 2022
1 parent 2c2d228 commit b104cbf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git-tag-version = false
36 changes: 36 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Release Process

This documents our release process.

## Update the Code

Checkout `master` and make sure to pull all the latest changes that sould be included in the release.

## Bump the Version

Use [`npm version`](https://docs.npmjs.com/cli/v6/commands/npm-version) to bump the version and update the changelog.
Most of the time you will want to run:

```
npm version <patch|minor|major>
```

For more details and other possible release types see [the npm docs](https://docs.npmjs.com/cli/v6/commands/npm-version).

This will:

1. Create and checkout a branch for the release preparation: `prepare-v<new-version>-<timestamp>`
1. Bump the version in `package.json` and `package.lock.json`
1. Update the changelog
1. Commit the changes and push the branch
1. If you have the [GitHub CLI](https://cli.github.com/) installed it will automatically open a _draft_ pull request to `master`

## Merge the Release Pull Request

This is a good point to clean up the changelog if needed and get feedback on the release.
When everyone is happy with the release, merge the pull request to `master`.

## Tag the Release

Back on `master`, tag the release and based on the new tag crate a release on GitHub.
This is a step we might automate completely via GitHub Actions in the future.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"postinstall": "husky install",
"lint": "prettier --check --no-error-on-unmatched-pattern src/**/*.{js,jsx,json,css,md}",
"format": "prettier --write --no-error-on-unmatched-pattern src/**/*.{js,jsx,json,css,md}",
"changelog": "node scripts/changelog.mjs"
"version": "node scripts/changelog.mjs && git checkout -b \"prepare-v${npm_package_version}-$(date +%s)\" && git add --all && git commit --message \"chore(release): prepare v${npm_package_version}\" && git push --set-upstream origin $(git branch --show-current)",
"postversion": "which gh && gh pr create --title \"chore(release): prepare v${npm_package_version}\" --body \"Prepares the v${npm_package_version} release.\" --assignee @me --label release --repo joinmarket-webui/joinmarket-webui --draft"
},
"eslintConfig": {
"extends": [
Expand Down
4 changes: 1 addition & 3 deletions scripts/changelog.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import conventionalChangelog from 'conventional-changelog'
import fs from 'fs'

const pkg = JSON.parse(fs.readFileSync('./package.json'))

const START_OF_LAST_RELEASE_PATTERN = /(^#+ \[?[0-9]+\.[0-9]+\.[0-9]+|<a name=)/m

const file = 'CHANGELOG.md'
Expand Down Expand Up @@ -68,4 +66,4 @@ const generateChangelog = (newVersion) => {
})
}

await generateChangelog(pkg.version)
await generateChangelog(process.env.npm_package_version)

0 comments on commit b104cbf

Please sign in to comment.