Skip to content

Commit c7e74f9

Browse files
authored
Merge pull request #35 from EOSIO/develop
Release 3.0.1
2 parents 0006774 + 40a514c commit c7e74f9

File tree

6 files changed

+136
-56
lines changed

6 files changed

+136
-56
lines changed

.travis.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,36 @@ before_install:
77
- npm install -g typescript
88
stages:
99
- test
10-
- name: deploy
10+
- name: publish-edge
1111
if: (NOT type IN (pull_request)) AND (branch = develop)
12+
- name: publish-latest
13+
# Travis assigns the tag to branch for some reason. This matches any valid semver version.
14+
if: branch =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$
1215
jobs:
1316
include:
1417
- stage: test
1518
name: "Lint and Test"
1619
script:
1720
- npm run lint
1821
- npm run test
19-
- stage: deploy
20-
name: "Deploy to NPM"
22+
- stage: publish-edge
23+
name: "Publish @edge to NPM"
2124
script:
2225
- npm run build
2326
deploy:
2427
provider: script
2528
skip_cleanup: true
26-
script:
27-
- ./scripts/publish.sh
29+
script: ./scripts/publish-edge.sh
2830
on:
2931
branch: develop
32+
- stage: publish-latest
33+
name: "Publish @latest to NPM"
34+
script:
35+
- npm run build
36+
deploy:
37+
provider: script
38+
skip_cleanup: true
39+
script: ./scripts/publish-latest.sh
40+
on:
41+
all_branches: true
42+
condition: $TRAVIS_TAG =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "demux-eos",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "Demux-js Action Reader implementations for EOSIO blockchains",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -44,7 +44,8 @@
4444
"watch": "tsc -w",
4545
"lint": "tslint -c tslint.json src/**/*.ts",
4646
"test": "jest",
47-
"build-docs": "./build-docs.sh"
47+
"build-docs": "./build-docs.sh",
48+
"current-version": "echo $npm_package_version"
4849
},
4950
"jest": {
5051
"moduleFileExtensions": [

scripts/functions.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env bash
2+
3+
setup_git() {
4+
echo " Setting up git configuration..."
5+
6+
# Set the user name and email to match the API token holder
7+
# This will make sure the git commits will have the correct photo
8+
# and the user gets the credit for a checkin
9+
git config --global user.email "devops@block.one"
10+
git config --global user.name "blockone-devops"
11+
git config --global push.default matching
12+
13+
# Get the credentials from a file
14+
git config credential.helper "store --file=.git/credentials"
15+
16+
# This associates the API Key with the account
17+
echo "https://${GITHUB_API_KEY}:@github.com" > .git/credentials
18+
19+
echo "✔ Set up git configuration"
20+
}
21+
22+
clean_git() {
23+
echo " Cleaning working tree from changes..."
24+
# Make sure that the workspace is clean
25+
# It could be "dirty" if
26+
# 1. package-lock.json is not aligned with package.json
27+
# 2. npm install is run
28+
git checkout -- .
29+
30+
# Echo the status to the log so that we can see it is OK
31+
git status
32+
33+
if $(git diff-index --quiet HEAD --); then
34+
echo "✔ Working tree clean"
35+
return 0
36+
fi
37+
38+
echo "✖ Unable to clean working tree"
39+
echo " Git status:"
40+
git status
41+
return 1
42+
}
43+
44+
check_head() {
45+
echo " Checking if HEAD aligns with master..."
46+
git fetch origin master:master
47+
if ! [ "$(git rev-parse HEAD)" = "$(git show-ref refs/heads/master --hash)" ]; then
48+
echo "✖ Current HEAD does not match head of master!"
49+
echo " - HEAD: $(git rev-parse HEAD)"
50+
echo " - master: $(git show-ref refs/heads/master --hash)"
51+
return 1
52+
fi
53+
echo "✔ Current HEAD matches head of master"
54+
return 0
55+
}
56+
57+
check_version() {
58+
echo " Checking if version of tag matches version in package.json..."
59+
if ! [ "$TRAVIS_TAG" = "$(npm run current-version --silent)" ]; then
60+
echo "✖ Tag does not match the version in package.json!"
61+
echo " - Tag: $TRAVIS_TAG"
62+
echo " - Version: $(npm run current-version --silent)"
63+
return 1
64+
fi
65+
echo "✔ Tag matches version in package.json"
66+
echo " - Tag: $TRAVIS_TAG"
67+
echo " - Version: $(npm run current-version --silent)"
68+
return 0
69+
}
70+
71+
publish_edge() {
72+
echo " Publishing edge release to NPM..."
73+
74+
# Run the deploy build and increment the package versions
75+
current_commit="$(git rev-parse --short HEAD)";
76+
npm version prerelease -preid "${current_commit}" -no-git-tag-version
77+
git commit -a -m "Updating version [skip ci]"
78+
cp .npmrc.template $HOME/.npmrc
79+
npm publish --tag edge
80+
81+
echo "✔ Published edge release"
82+
}
83+
84+
publish_latest() {
85+
echo " Publishing new release to NPM..."
86+
87+
cp .npmrc.template $HOME/.npmrc
88+
npm publish
89+
90+
echo "✔ Published new release"
91+
}

scripts/publish-edge.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source $dir/functions.sh
5+
6+
setup_git || exit 1
7+
clean_git || exit 1
8+
if ! publish_edge; then
9+
echo "✖ Publishing of edge release to NPM failed"
10+
exit 1
11+
fi

scripts/publish-latest.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source $dir/functions.sh
5+
6+
setup_git || exit 1
7+
clean_git || exit 1
8+
check_head || exit 1
9+
check_version || exit 1
10+
if ! publish_latest; then
11+
echo "✖ Publishing of new release to NPM failed"
12+
exit 1
13+
fi

scripts/publish.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)