2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-22 10:08:55 +00:00

generate-changelog: integrate doc, creating tag, remind about smoke test

This commit is contained in:
Ronan Jouchet 2021-03-04 21:13:58 -05:00
parent 7ee2f97599
commit 9b455670c4
3 changed files with 34 additions and 62 deletions

View File

@ -68,3 +68,12 @@ but is painful to do manually. Do yourself a favor and install a
1. Run a TSC watcher: `npm run build:watch`
2. Run a Jest unit tests watcher: `npm run test:watch`
- Alternatively, you can run both test processes in the same terminal by running: `npm run watch`
## Release
While on `master`, with no uncommitted changes, run:
```bash
npm run changelog -- $VERSION
# With no 'v'. For example: npm run changelog -- 42.5.0
```

View File

@ -1,21 +1,25 @@
#!/usr/bin/env bash
#
# Updates the changelog and version in the package.json
# Will also create a commit with these changes locally
# Run `git commit --amend` after that if you wish to make changes
#
# Usage:
# ./changelog "7.0.0"
# ./generate-changelog -- "7.0.0"
#
# Prerequisites:
# - On master branch
# - No uncommitted changes
#
# Dependencies:
# - git-extras https://github.com/tj/git-extras/blob/master/Installation.md
# - git-extras: https://github.com/tj/git-extras/blob/master/Installation.md
# - jq: https://stedolan.github.io/jq/download/
set -eo pipefail
echo 'HEY YOU. Did you run the quick pre-release smoke test? ( npm run test:manual )'
echo 'Press any key to continue, or Ctrl+C to abort'
read -r
# Checks if we are on the master branch
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" != 'master' ]]; then
@ -35,17 +39,27 @@ if ! [[ $VERSION =~ $SEMVER_REGEX ]]; then
exit 1
fi
# Change the version in the package.json
# 1. Update the version in the package.json
cat package.json | jq ".version = \"$VERSION\"" > package.json.tmp
mv package.json.tmp package.json # workaround for in-place jq editing
# Workaround for inplace jq editing
mv package.json.tmp package.json
# Unset the editor so that git changelog does not open a editor
EDITOR=:
# 2. Compile new commits from CHANGELOG.md, and open it in your EDITOR for cleanup
git changelog CHANGELOG.md --tag "$VERSION"
# Commit these changes
# 3. Commit the changes
git add CHANGELOG.md
git add package.json
git commit -m "Update changelog for \`v$VERSION\`"
# 4. Create an annotated tag
git tag -a "v$VERSION" -m "v$VERSION"
# 5. List remaining work
echo
echo 'Please verify commit & tag look fine in Git, then:'
echo ' 1. Push: git push --follow-tags origin master'
echo ' 2. Create a GitHub Release at https://github.com/nativefier/nativefier/releases ,'
echo " using created tag v$VERSION and with title \"Nativefier v$VERSION\" (yes, with a \"v\")."
echo
echo 'GitHub Action "publish" will react on the new release, and publish it to npm.'
echo 'The new version will be visible on npm within a few minutes/hours.'

View File

@ -1,51 +0,0 @@
# Release
Releases are automatically deployed to npm from Travis, when they are tagged.
However, we have to make sure that the version in the `package.json`,
and the changelog is updated.
## Tests
Before anything, run a little manual smoke test of some of our
hard-to-programatically-test features:
```bash
npm run test:manual
```
## How to release
With [Git Extras](https://github.com/tj/git-extras/blob/master/Installation.md)
and [jq](https://stedolan.github.io/jq/download/) installed.
While on `master`, with no uncommitted changes,
```bash
npm run changelog -- $VERSION
# With no 'v'. For example: npm run changelog -- 7.7.1
```
This command does 3 things:
1. Update the version in the `package.json`
2. Update the changelog
3. Creates a new commit with the changes
Now we may want to cleanup the changelog:
```bash
vim CHANGELOG.md
git commit --amend
```
Once we are satisfied,
```bash
git tag -a vX.Y.Z -m 'vX.Y.Z'
git push --follow-tags origin master
```
On [GitHub Releases](https://github.com/nativefier/nativefier/releases),
draft and publish a new release with title `Nativefier vX.Y.Z` (yes, with a `v`).
Our CI will react on the new release, and publish it to npm.
The new version will be visible on npm within a few minutes.