Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarcia360 committed Mar 23, 2020
2 parents dec27b4 + 4fbe805 commit fcd2ff9
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 17 deletions.
24 changes: 17 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@ script:
- npx embedme README.md --verify
- npm run coveralls-report
before_deploy:
- npx typedoc --out ts-docs src
- CURRENT_VERSION=$(npm run version --silent)
- npx typedoc --out "ts-docs/$CURRENT_VERSION" src
- touch ./ts-docs/.nojekyll
deploy:
provider: pages
skip_cleanup: true
local_dir: ts-docs
github_token: $GITHUB_TOKEN
on:
branch: master
- provider: script
skip_cleanup: true
script: /bin/sh travis/github-pages.sh
on:
branch: master
- provider: script
skip_cleanup: true
script: /bin/sh travis/uploadArchives.sh
on:
branch: master
- provider: script
skip_cleanup: true
script: /bin/sh travis/release.sh
on:
branch: $RELEASE_BRANCH
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const serializedTransaction = 'B500000000000000406D262D78CE449BC743A2F27FFE05A67
'90D69CD255E556C640420F00000000000074657374';

const URI = 'web+nem://transaction?data='+ serializedTransaction + '&generationHash=test' +
'&endpoint=http://localhost:3000&webhook=http://myapp.local/id';
'&nodeUrl=http://localhost:3000&webhookUrl=http://myapp.local/id';
const transactionURI = TransactionURI.fromURI(URI);

const transaction = transactionURI.toTransaction();
Expand Down
15 changes: 6 additions & 9 deletions src/webhooks/AnnounceTransactionWebhookBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@ interface AnnounceTransactionWebhookDTO extends WebhookDTO {
*/
export class AnnounceTransactionWebhookBuilder implements IWebhookBuilder {

private readonly webhook: AnnounceTransactionWebhookDTO;

constructor(public readonly hash: string,
public readonly signerPublicKey: string) {
this.webhook = {action: 'AnnounceTransaction',
data: {
hash: this.hash,
signerPublicKey: this.signerPublicKey
}
};
}

/**
* Build the webhook DTO
*/
build(): AnnounceTransactionWebhookDTO {
return this.webhook;
return {action: 'AnnounceTransaction',
data: {
hash: this.hash,
signerPublicKey: this.signerPublicKey
}
};
}
}
1 change: 1 addition & 0 deletions travis/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
21 changes: 21 additions & 0 deletions travis/github-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e

PUBLICATION_BRANCH=gh-pages
# Checkout the branch
REPO_PATH=$PWD
CURRENT_VERSION=$(npm run version --silent)
rm -rf $HOME/publish
cd $HOME
git clone --branch=$PUBLICATION_BRANCH https://${GITHUB_TOKEN}@github.com/$TRAVIS_REPO_SLUG publish 2>&1 > /dev/null
cd publish
# Update pages

cp -r $REPO_PATH/ts-docs/. ./
# Commit and push latest version
git add .
git config user.name "Travis"
git config user.email "travis@travis-ci.org"
git commit -m "Uploading $CURRENT_VERSION docs."
git push -fq origin $PUBLICATION_BRANCH 2>&1 > /dev/null
cd $REPO_PATH
60 changes: 60 additions & 0 deletions travis/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -e

if [ "$TRAVIS_BRANCH" = "$RELEASE_BRANCH" ]; then

REMOTE_NAME="origin"
POST_RELEASE_BRANCH="post-$RELEASE_BRANCH"

git remote rm $REMOTE_NAME

echo "Setting remote url https://github.com/${TRAVIS_REPO_SLUG}.git"
git remote add $REMOTE_NAME "https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" > /dev/null 2>&1

echo "Checking out $RELEASE_BRANCH as travis leaves the head detached."
git checkout $RELEASE_BRANCH

CURRENT_VERSION=$(npm run version --silent)

echo "Current Version"
echo "$CURRENT_VERSION"
echo ""

echo "Testing git remote"
git branch -vv
echo ""

echo "Creating tag v$CURRENT_VERSION"
git tag -fa "v$CURRENT_VERSION" -m "Releasing version $CURRENT_VERSION"

cp travis/.npmrc $HOME/.npmrc

# The $SKIP_RELEASE_PUBLISH env variable can avoid republishing the same version to npm if something in the release process fails.
if [ "$SKIP_RELEASE_PUBLISH" = "true" ]; then
echo "Skipping publishing of library artifacts"
echo ""
else
echo "Publishing library artifacts"
npm publish
echo ""
fi

echo "Increasing library version"
npm version patch -m "Increasing version to %s" --git-tag-version false

CURRENT_VERSION=$(npm run version --silent)

echo "New Version"
echo "$CURRENT_VERSION"
echo ""

git add .
git commit -m "Creating new version $CURRENT_VERSION"

echo "Pushing code to $REMOTE_NAME $POST_RELEASE_BRANCH"
git push --set-upstream $REMOTE_NAME $RELEASE_BRANCH:$POST_RELEASE_BRANCH
echo "Pushing tags to $REMOTE_NAME"
git push --tags $REMOTE_NAME
else
echo "Release is disabled"
fi
12 changes: 12 additions & 0 deletions travis/uploadArchives.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e

CURRENT_VERSION=$(npm run version --silent)
NEW_VERSION="$CURRENT_VERSION-alpha-$(date +%Y%m%d%H%M)"

echo "Uploading npm package version $NEW_VERSION"
cp travis/.npmrc $HOME/.npmrc

npm version "$NEW_VERSION" --commit-hooks false --git-tag-version false

npm publish --tag alpha

0 comments on commit fcd2ff9

Please sign in to comment.