@practio/ci
v1.21.18
Published
Prod, PR and Deploy only builds for CI server
Downloads
83
Readme
What is Practio CI?
A simple CLI tool to work with Pull Requests on GitHub and deploy them (prod builds on the CI server).
Quick start
Install on CI
npm install --force @practio/ci -g
This gives you three new command line commands:
pr
for working with Pull Requests.stage
to stage a branch to staging.prod
for deploying to production.
Workflow
Creating a Pull Request with pr
You are on the master
branch, you have made a few changes that you have not comitted with git and you want to do a Pull Request. You do:
pr "My new feature"
This will create a branch, commit you changes, push your branch to GitHub and create a Pull Request. If you want you initial commit to have a different message that the feature name, you can do: pr "My new feature" "Initial commit message"
.
Pushing changes to your Pull Request with pr
You are now on your Pull Request branch.
You have made some changes to your local code and want to commit the changes and push them to your Pull Request branch on GitHub, just do:
pr "Some message describing the changes I just did"
This will be the commit message of the changes, you can write any message here. Notice you don't have to use the pr
command here, you can also opt for a normal git commit -am "message" && git push
flow.
Deploying to staging with stage
You need to test your code in a staging environment to get it approved. Just do:
stage
And the command will take care of deploying it to Heroku and notify the team at #staging.
It will also change the TRANSLATION_BRANCH
config in Heroku to make sure you have the latest Crowdin translation branch.
Revert staging to master
. Just do:
stage master
Some times you need to force a staging (with an empty commit), just do:
stage -f
Deploying to production with prod
You have now gotten a code review of your Pull Request, you have pushed the changes you did from the review comments and you want to deploy your current pull request. Just do:
prod "My deploy message and commit message"
The message you choose is both the message sent to the #deploy channel on slack, and the commit message in the master
branch of the squashed merge commit of the Pull Request branch. You can write any message here. Choose something that describes all the changes you did in the Pull Request.
If the deploy to production fails for any reason, you can issue new prod
commands to try deploying again.
Straight to production with prod
When you want to deploy a small change straight to production fast without any code review, you just do you code changes while on the master
branch, you do not commit anything with git, you just do:
prod "My deploy message, and commit message when this is merged to master branch"
💥 Your code changes go straight to production.
On the CI server
On the CI server you use the command practio-ci
also installed with this module:
Usage: practio-ci [options]
||Options:|
|:-|-|
|-V, --version
|output the version number|
|--test-when-files [files...]
|Wait for the files (comma seperated) to|
||be present on the filesystem before|
||proceeding with running tests. Will time|
||out after 5 mins (default: [])|
|--npm-when-files [files...]
|Wait for the files (comma seperated) to|
||be present on the filesystem before|
||proceeding with npm commands. Will time|
||out after 5 mins (default: [])|
|--mocha-reporter <reporter>
|Install and change the reporter in mocha|
||to the specified reporter, removing it|
||again after "npm test" has run|
|--mocha-reporter-options <options>
|Reporter options for mocha (default: [])|
|--jest-reporter <reporter>
|Install and change the reporter in jest|
||to the specified reporter, removing it|
||again after "npm test" has run (default:|
||[])|
|--cypress-script <script>
|The cypress script to use for cypress|
||run, temporarily overwriting th script in|
||package.json wile npm test is run|
|--touch-file-on-smooth-run <file>
|Touches the specified file when|
||practio-ci exits in a expected way. If|
||this file is not present after running|
||practio-ci, you need to notify the user|
||that something went wrong.|
|--mergeAndTestOnly
|Only merge changes to master and run|
||tests|
|--deployOnly
|Only deploy (only deploys if in a prod or|
||master build)|
|--testSlug
|If running heroku slug upload, then test|
||the slug before uploading it|
|--node <path>
|path to downloaded node.js files and bin|
||folder. Contents is copied to the slug|
||uploaded to heroku|
|-u, --update
|Updates the practio-ci commands|
|-h, --help
|display help for command|
Development of this CLI tool
To publish a new version run: npm version
to update a new version and then npm publish
to publish in the NPM repository.