Scripts for npm standard version updates w/ node repositories.
Create Personal Access Token
- Skip this step if a github token is already available.
- Go to https://github.com/settings/tokens/new while logged in to the Bot User.
- Set a reasonable and recognizable
Token description
. - Check
public_repo
underSelect scopes
. - Generate token.
- Copy the token highlighted with green background before it disappears.
- Paste the token somewhere safe but readable.
Make Bot User Admin
- Navigate to the repository for the npm package requiring devOps.
- Add Bot User as an Admin.
Create Access Token
- Skip if NPM token is already available.
- Log into NPM registry as bot user.
- Click profile avatar, then click
Tokens
- Click
Create New Token
- Select
Read and Publish
thenCreate Token
- Copy the token in box before it disappears.
- Paste the token somewhere safe but readable.
Migrate Travis Integration to Github Application
- Follow instructions on Travis
First-time Travis Application
- Login to Org owner account
- Go to https://github.com/marketplace/travis-ci#pricing-and-setup
- Choose
Open Source
- Click
Install it for free
- Click
Complete order and begin installation
- Decide whether to pick and choose or include all repositories.
Setting Up Repository in Travis
- Go to Settings
- Add GITHUB_TOKEN and NPM_TOKEN as environment variables
- Turn on
Auto cancel pull request builds
- For Github Enterprise, Add ssh key for bot user
Setting Up Merge Style
- Navigate to Settings/Options
- DO NOT check
Allow squash merging
- DO NOT check
Allow rebase merging
Setting Up Branch Protection
- Default Branch:
develop
- Branch protection rules:
master
- Require pull request reviews before merging
- Require status checks to pass before merging
- Status checks found in the last week for this repository: list shows up after first run
- Require branches to be up to date before merging
- Include administrators
- Branch protection rules:
develop
- Require pull request reviews before merging
- Require status checks to pass before merging
- Status checks found in the last week for this repository: list shows up after first run
- DO NOT require
Travis CI - Branch
- DO NOT require
- Require branches to be up to date before merging
- DO NOT: Include administrators
Setting Up Repository for Travis
- Add a
.travis.yml
with following informationlanguage: node_js node_js: - '8' before_install: - npm i -g makeshift && makeshift -r https://registry.npmjs.org - npm i -g standard-version before_script: - cd /tmp - wget https://github.com/github/hub/releases/download/v2.5.1/hub-linux-386-2.5.1.tgz - tar -xvzf hub-linux-386-2.5.1.tgz - mv hub-linux-386-2.5.1 hub - export PATH=${PATH}:/tmp/hub/bin - git clone -b master https://github.com/ibm-developer/standard-npm-devops.git - cd - script: npm test && npm run coveralls && /tmp/standard-npm-devops/do_devops.sh branches: only: - master - develop env: - DEV_BRANCH=develop PROD_BRANCH=master DEVOPS_SCRIPT_DIR="/tmp/standard-npm-devops"
Travis CI Notification
- Log into a Bot Account on Slack
- Select
Customize Slack
under the desired workspace - Select
Configure Apps
- Add a Travis CI configuration
- Follow the instructions for
Encrypting your credentials
Changelog Notification
- Find
Incoming Hooks
underCustom Integrations
- Copy
Webhook URL
and add a environment variable in Travis called SLACK_WEBHOOK - Add the following in
.travis.yml
- Under
before_install
- npm i -g markdown-to-html
- Under
before_script
- git clone -b master https://github.com/ibm-developer/changelog-generator-slack-notification.git - npm install changelog-generator-slack-notification
- Under
env
: add to first entrySLACK_NOTIFICATION_PATH="/tmp/changelog-generator-slack-notification"
so it becomes:- DEV_BRANCH=develop PROD_BRANCH=master DEVOPS_SCRIPT_DIR="/tmp/standard-npm-devops" SLACK_NOTIFICATION_PATH="/tmp/changelog-generator-slack-notification"
- Under
Pull Request to develop
- Make sure commits follows conventional commits standards. Merge commits are ok.
- Make sure merging branch is in sync with
develop
- Make sure there are no open Pull Request from
develop
to master
Pull Request to master
- Make sure to Pull Request from
develop
- Pull Request from other branches are tolerable in emergencies, but will result in
develop
branch needing admin intervention to sync. - Make sure there is at least one new commit that follows conventional commits standards.
- Build will attempt to sync
master
and create a version release commit.
Publishing
master
branch build will push new version tag to Githubmaster
branch build will publish new version to NPM