Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.0.1 #35

Merged
merged 28 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
23 changes: 18 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,36 @@ before_install:
- npm install -g typescript
stages:
- test
- name: deploy
- name: publish-edge
if: (NOT type IN (pull_request)) AND (branch = develop)
- name: publish-latest
# Travis assigns the tag to branch for some reason. This matches any valid semver version.
if: branch =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$
jobs:
include:
- stage: test
name: "Lint and Test"
script:
- npm run lint
- npm run test
- stage: deploy
name: "Deploy to NPM"
- stage: publish-edge
name: "Publish @edge to NPM"
script:
- npm run build
deploy:
provider: script
skip_cleanup: true
script:
- ./scripts/publish.sh
script: ./scripts/publish-edge.sh
on:
branch: develop
- stage: publish-latest
name: "Publish @latest to NPM"
script:
- npm run build
deploy:
provider: script
skip_cleanup: true
script: ./scripts/publish-latest.sh
on:
all_branches: true
condition: $TRAVIS_TAG =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "demux-eos",
"version": "3.0.0",
"version": "3.0.1",
"description": "Demux-js Action Reader implementations for EOSIO blockchains",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -44,7 +44,8 @@
"watch": "tsc -w",
"lint": "tslint -c tslint.json src/**/*.ts",
"test": "jest",
"build-docs": "./build-docs.sh"
"build-docs": "./build-docs.sh",
"current-version": "echo $npm_package_version"
},
"jest": {
"moduleFileExtensions": [
Expand Down
91 changes: 91 additions & 0 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env bash

setup_git() {
echo " Setting up git configuration..."

# Set the user name and email to match the API token holder
# This will make sure the git commits will have the correct photo
# and the user gets the credit for a checkin
git config --global user.email "devops@block.one"
git config --global user.name "blockone-devops"
git config --global push.default matching

# Get the credentials from a file
git config credential.helper "store --file=.git/credentials"

# This associates the API Key with the account
echo "https://${GITHUB_API_KEY}:@github.com" > .git/credentials

echo "✔ Set up git configuration"
}

clean_git() {
echo " Cleaning working tree from changes..."
# Make sure that the workspace is clean
# It could be "dirty" if
# 1. package-lock.json is not aligned with package.json
# 2. npm install is run
git checkout -- .

# Echo the status to the log so that we can see it is OK
git status

if $(git diff-index --quiet HEAD --); then
echo "✔ Working tree clean"
return 0
fi

echo "✖ Unable to clean working tree"
echo " Git status:"
git status
return 1
}

check_head() {
echo " Checking if HEAD aligns with master..."
git fetch origin master:master
if ! [ "$(git rev-parse HEAD)" = "$(git show-ref refs/heads/master --hash)" ]; then
echo "✖ Current HEAD does not match head of master!"
echo " - HEAD: $(git rev-parse HEAD)"
echo " - master: $(git show-ref refs/heads/master --hash)"
return 1
fi
echo "✔ Current HEAD matches head of master"
return 0
}

check_version() {
echo " Checking if version of tag matches version in package.json..."
if ! [ "$TRAVIS_TAG" = "$(npm run current-version --silent)" ]; then
echo "✖ Tag does not match the version in package.json!"
echo " - Tag: $TRAVIS_TAG"
echo " - Version: $(npm run current-version --silent)"
return 1
fi
echo "✔ Tag matches version in package.json"
echo " - Tag: $TRAVIS_TAG"
echo " - Version: $(npm run current-version --silent)"
return 0
}

publish_edge() {
echo " Publishing edge release to NPM..."

# Run the deploy build and increment the package versions
current_commit="$(git rev-parse --short HEAD)";
npm version prerelease -preid "${current_commit}" -no-git-tag-version
git commit -a -m "Updating version [skip ci]"
cp .npmrc.template $HOME/.npmrc
npm publish --tag edge

echo "✔ Published edge release"
}

publish_latest() {
echo " Publishing new release to NPM..."

cp .npmrc.template $HOME/.npmrc
npm publish

echo "✔ Published new release"
}
11 changes: 11 additions & 0 deletions scripts/publish-edge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $dir/functions.sh

setup_git || exit 1
clean_git || exit 1
if ! publish_edge; then
echo "✖ Publishing of edge release to NPM failed"
exit 1
fi
13 changes: 13 additions & 0 deletions scripts/publish-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $dir/functions.sh

setup_git || exit 1
clean_git || exit 1
check_head || exit 1
check_version || exit 1
if ! publish_latest; then
echo "✖ Publishing of new release to NPM failed"
exit 1
fi
49 changes: 0 additions & 49 deletions scripts/publish.sh

This file was deleted.