adhocore/please
please
(aka php release or even npm release) is very simple Github+NPM release for PHP and/or Nodejs projects.
Assumes you like semantic versioning of the format <major>.<minor>.<patch>
!
Actually you can release any thing not just PHP/Nodejs. Please itself is released by please.
Working
- Determine remote git repo based on local git config
- Checkout and Update
master
- Get latest release from github api endpoint
- Collect new commits since the latest release
- Create a changelog (prepend to if exists), reflect that into
./CHANGELOG.md
file and commit it - Bump the version, reflect that into
./VERSION
file and commit it- If any of the latest commits start with
feat
<minor>
is bumped - But if only you didnt explicitly pass
scope
already
- If any of the latest commits start with
- If there is
package.json
file, bumppackage.json#version
and commit it - If
package.json#private
is not set totrue
- If npm user not already logged in, run
npm adduser
- Run
npm publish
finally
- If npm user not already logged in, run
- Release the new version and tag to github
- If there is
box.json
file, compile phar usingbox
(downloadbox.phar
if required) - Upload the compiled
phar
as asset for the recent release
Installation
# Requirements:
# jq
sudo apt install jq -y
curl -sSLo ~/please https://raw.githubusercontent.com/adhocore/please/master/please
chmod +x ~/please && sudo ln -s ~/please /usr/local/bin/please
Setup
One time setup. In your .bashrc
/ .zshrc
or the like export github token:
export GH_AUTH_TOKEN=<your token here>
Get your token from here. Make sure to set only bare minimum permission scopes for this token.
What permissions
- repo if you want to release private repos
- public_repo required
- repo_deployment required
Important: Tokens are to be treated and kept as much secret as passwords.
Usage
Make sure you have already merged required commits to master
branch in Github,
then go to the root of any project you want to release and run:
please [Scope] [Options]
Scope
major Bumps the <major> part of semver.
minor Bumps the <minor> part of semver.
Options
-c --chlog Forces creation of CHANGELOG.md file.
-h --help Show help information and usage.
-H --chash Prepends commit hash into log.
-p --public Set scoped npm package for public access.
-u --update Update please to latest version.
-v --vfile Forces creation of VERSION file.
-y --yes Assume yes for any confirmation.
Examples
please
please --update
please --vfile --chash
please minor --public --yes
please major --vfile --chlog
Note
- If there is
VERSION
file in project root, you dont need--vfile
flag. - If there is
CHANGELOG.md
file in project root, you dont need--chlog
flag. - If there is
box.json
file in project root, it builds and releases.phar
too. - If no scope is given, bumps the
<patch>
part of semver.
Output
Here's output of please in action, releasing 0.0.1 of itself:
$ ./please --vfile
Repository adhocore/please
Log file /tmp/PLZEXKbyF
Updating master ...
Done
Getting latest releases ...
Done
Current Version 0.0.0
Collecting commits ...
Done
Bumping version ...
Done
Releasing 0.0.1 ...
Done
Check /tmp/PLZEXKbyF for logs
And here is colorful screenshot of please
releasing v0.0.10 of phint
And here is a preview of all features of please
in one release:
Sample changelog
CHANGELOG.md generated by please
looks like:
## [0.0.1] 2018-01-01 00:00:00 UTC
- commit 1 (Author Name)
- commit 2 (Author Name)
...
If you passed in --chash
flag then:
## [0.0.1] 2018-01-01 00:00:00 UTC
- [<commit1hash>](https://github.com/<repo>/commit/<commit1hash>) commit 1 (Author Name)
- [<commit2hash>](https://github.com/<repo>/commit/<commit2hash>) commit 2 (Author Name)
...
On subsequent releases new changes are prepended such that latest commits stay at top.
Troubleshooting
If you are using zsh
then please
might have been already aliased to sudo
. To fix this simply run
echo "alias please=/usr/local/bin/please" >> ~/.zshrc
source ~/.zshrc