openethereum/js/scripts/release.sh
Jaco Greeff 70f87ea002 Publish parity.js to npmjs registry (#2978)
* Skeleton packages

* Publish parity.js package to npm

* [ci skip] js-precompiled 20161029-190427

* Extra step information

* [ci skip] js-precompiled 20161029-192209

* Use autToken for npmjs (cannot run headless in docker)

* [ci skip] js-precompiled 20161029-193414

* Correct package.json structure

* [ci skip] js-precompiled 20161029-194003

* Scope package to public

* [ci skip] js-precompiled 20161029-194529

* Start package version at 0.1.0

* Build proper umd library

* [ci skip] js-precompiled 20161029-231233

* Update build/release stage

* [ci skip] js-precompiled 20161030-071454

* Basic README.md to satisfy npmjs

* [ci skip] js-precompiled 20161030-073150

* CommonJs format

* [ci skip] js-precompiled 20161030-075034

* Update README.md

* update dependencies

* [ci skip] js-precompiled 20161030-075727

* Starting package version

* Build only on master
2016-10-30 09:55:46 +01:00

85 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -e
# variables
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
PACKAGES=( "parity.js" )
BRANCH=$CI_BUILD_REF_NAME
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/js-precompiled.git"
GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/parity.git"
# setup the git user defaults for the current repo
function setup_git_user {
git config push.default simple
git config merge.ours.driver true
git config user.email "$GITHUB_EMAIL"
git config user.name "GitLab Build Bot"
}
# change into the build directory
BASEDIR=`dirname $0`
GITLOG=./.git/gitcommand.log
pushd $BASEDIR
cd ../.dist
# add local files and send it up
echo "*** Setting up GitHub config for js-precompiled"
rm -rf ./.git
git init
setup_git_user
echo "*** Checking out $BRANCH branch"
git remote add origin $GIT_JS_PRECOMPILED
git fetch origin 2>$GITLOG
git checkout -b $BRANCH
echo "*** Committing compiled files for $UTCDATE"
git add .
git commit -m "$UTCDATE"
echo "*** Merging remote"
git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [release]"
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
PRECOMPILED_HASH=`git rev-parse HEAD`
# move to root
cd ../..
echo "*** Setting up GitHub config for parity"
setup_git_user
git remote set-url origin $GIT_PARITY
git reset --hard origin/$BRANCH 2>$GITLOG
echo "*** Bumping package.json patch version"
cd js
npm --no-git-tag-version version
npm version patch
cd ..
echo "*** Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH"
cargo update -p parity-ui-precompiled
# --precise "$PRECOMPILED_HASH"
echo "*** Committing updated files"
git add Cargo.lock js/package.json
git commit -m "[ci skip] js-precompiled $UTCDATE"
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
echo "*** Building packages for npmjs"
cd js
# echo -e "$NPM_USERNAME\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login
echo "$NPM_TOKEN" >> ~/.npmrc
npm run ci:build:npm
echo "*** Publishing $PACKAGE to npmjs"
cd .npmjs
npm publish --access public
cd ..
# back to root
echo "*** Release completed"
popd
# exit with exit code
exit 0