Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,55 @@ jobs:
- npm run test-unit
- bash <(curl -s https://codecov.io/bash) -c -Z -f .coverage/coverage-final.json -F unit

# create a new release if $CREATE_RELEASE is set
- stage: Create Release
if: env(CREATE_RELEASE) = true AND type = api AND tag IS blank
os: osx
node_js: 12
git:
depth: false # disable --depth
script:
# fail-fast using set -e
- set -e
# decrypt and ssh-add the deploy-key
- openssl aes-256-cbc -K $encrypted_05f822b6caa8_key -iv $encrypted_05f822b6caa8_iv
-in .github/travis-deploy-key.enc -out /tmp/travis-deploy-key -d
- chmod 600 /tmp/travis-deploy-key
- eval "$(ssh-agent -s)"
- ssh-add /tmp/travis-deploy-key
- rm /tmp/travis-deploy-key
# convert remote URL from HTTPS to SSH
- git remote set-url origin $(git config --get remote.origin.url | sed -E 's#(http.*://)([^/]+)/(.+)$#git@\2:\3#g')
- ssh-keyscan github.com >> ~/.ssh/known_hosts
# create release
- npm run release $PUSH_TO_ORIGIN $PRERELEASE_SUFFIX
- set +e

# publish npm package on tagged builds
- stage: Publish Package
if: tag IS present
os: osx
node_js: 12
git:
depth: false # disable --depth
script:
# fail-fast using set -e
- set -e
# get prerelease suffix from version tag
- TAG=$(echo $TRAVIS_TAG | sed 's/^.*-\([a-z]*\).*$/\1/')
# set to `latest` in case of no suffix
- TAG=$([ "${TAG}" = "$TRAVIS_TAG" ] && echo "latest" || echo $TAG)
# make sure `latest` tag is create from master branch
- '[ "$TAG" = "latest" ] && [ $(git rev-parse HEAD) != $(git rev-parse origin/master) ] && return 1 || return 0'
- set +e
deploy:
edge: true # opt in to dpl v2
provider: npm
tag: $TAG
on:
tags: true
all_branches: true

# update gh-pages docs on master
- stage: Publish Docs
if: branch = master
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ master:
- GH-49 Dropped support for Node < v10
chores:
- GH-50 Convert EncodeSet to ES6 class
- GH-52 Automated releases and publish process
- GH-51 Automated gh-pages docs deployment
- >-
GH-49 Updated .npmignore to prevent the addition of tests and config
Expand Down
28 changes: 28 additions & 0 deletions npm/create-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node
// ---------------------------------------------------------------------------------------------------------------------
// This script is intended to automate the versioning and changelog generation process for a release.
// ---------------------------------------------------------------------------------------------------------------------


const shipit = require('@postman/shipit'),

// npm run release [true] [beta]
[pushToOrigin, preReleaseSuffix] = process.argv.splice(2);

// only support `beta` suffix
if (preReleaseSuffix && preReleaseSuffix !== 'beta') {
throw new Error(`Can't prerelease with \`${preReleaseSuffix}\` suffix.`);
}

// 🚢 Just Ship It!
shipit({
// don't push to origin unless explicitly set
pushToOrigin: pushToOrigin === 'true',
// prerelease suffix, if any
preReleaseSuffix: preReleaseSuffix
}).then((version) => {
console.info('🚀', version);
}).catch((err) => {
console.error('🔥', err);
process.exit(1);
});
148 changes: 148 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
],
"scripts": {
"build-docs": "node npm/build-docs.js",
"release": "node npm/create-release.js",
"test": "npm run test-lint && npm run test-unit",
"test-benchmark": "node npm/test-benchmark.js",
"test-lint": "node npm/test-lint.js",
Expand All @@ -33,12 +34,13 @@
},
"devDependencies": {
"@postman/csv-parse": "^4.0.2",
"@postman/shipit": "0.1.0",
"async": "^3.1.1",
"bipbip": "^0.4.1",
"chai": "^4.2.0",
"chalk": "4.1.0",
"editorconfig": "^0.15.3",
"colors": "^1.4.0",
"editorconfig": "^0.15.3",
"eslint": "^7.10.0",
"eslint-plugin-jsdoc": "^30.6.2",
"eslint-plugin-lodash": "^7.1.0",
Expand Down