The pubnpm
script is intended to be executed in the repository folder
immediately after CHANGELOG.md
has been modified in preparation for the
release.
pubnpm
is intended for repositories that have a package.json
file. If a
build
script exists in package.json
then npm install
will be run before
publishing.
Both scripts require a single argument, the release type, which is one of the following: [patch | minor | major]
# a npm patch release
$ pubnpm patch
pubnpm
options:
-h
or--help
: Show help.-v
or--verbose
: Be verbose running commands.-C
or--color=WHEN
: Color mode: always, auto, never (default:PUBNPM_COLOR
env var orauto
).-n
or--dry-run
: Show commands that will be run without executing them.-t TAG
or--tag=TAG
: Use the npm publish tag feature-b BRANCH
or--branch=BRANCH
: Ensure running on a git branch (default: main, empty string to skip).-N
or--new
: Skip owner check for a new package.-P
or--public
: Used withnew
to specify that a scoped package is public.-R
or--restricted
: Used withnew
to specify that a scoped package is private/restricted.
NOTE: MacOS only supports short options.
The tag feature is useful if releasing to a "dev" branch vs the "latest":
pubnpm -v -t dev patch
pubnpm -N -P major
pubnpm -N -P -b master major
Start by cloning this repo somewhere and symlink the two pub* executables into ~/bin (or some custom location in your PATH).
Running pubtag
will result in an updated CHANGELOG.md
and TWO new commits,
which are automatically pushed to main
.
Note that this will require admin access on the repo to bypass main
push
protection.
You will not be able to publish a release if you are not an admin and branch protection is enabled.
The process:
- Update
CHANGELOG.md
by replacing the date placeholders with the current date- NOTE: DO NOT create a manual commit
- Note the semver; note if this is a patch, minor or major update
- Run
pubtag
based on the type of update:- E.g., for a minor release,
pubtag minor
- E.g., for a minor release,
Then, if successful you will observe new commits pushed to main and a packaging github action running against main.
Once completed, take the image artifact tag and revise the associated terraform repo to deploy.
If there's a failure (e.g., insufficient permissions), you will need to reset some git history.
Check the latest commit on origin/main
before you executed the script.
Then do a hard reset:
git reset --hard COMMIT
Then, delete the tag:
git tag -d TAG
Where tag
has the format vMAJOR.MINOR.PATCH
.
You should be back to a clean state with local history matching the published repo.