diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 638c0aa69c5..65161317efa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -690,9 +690,10 @@ js-release: script: - rustup default stable - echo $JS_FILES_MODIFIED - - if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS rebuild since no JS files modified."; else ./js/scripts/build.sh && ./js/scripts/release.sh; fi + - if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS rebuild since no JS files modified."; else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh; fi - echo $JS_OLD_FILES_MODIFIED - - if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) rebuild since no JS files modified."; else ./js-old/scripts/build.sh && ./js-old/scripts/release.sh; fi + - if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) rebuild since no JS files modified."; else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh; fi + - if [ $JS_FILES_MODIFIED -eq 0 ] || [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping Cargo update since no JS files modified."; else ./js/scripts/push-cargo.sh; fi tags: - javascript diff --git a/js-old/scripts/release.sh b/js-old/scripts/push-precompiled.sh old mode 100755 new mode 100644 similarity index 51% rename from js-old/scripts/release.sh rename to js-old/scripts/push-precompiled.sh index c4c9b8d8a86..74c0921d263 --- a/js-old/scripts/release.sh +++ b/js-old/scripts/push-precompiled.sh @@ -5,7 +5,6 @@ set -e UTCDATE=`date -u "+%Y%m%d-%H%M%S"` PRECOMPILED_BRANCH="v1" GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git" -GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/parity.git" # setup the git user defaults for the current repo function setup_git_user { @@ -22,17 +21,17 @@ pushd $BASEDIR cd ../.dist # add local files and send it up -echo "*** [v1] Setting up GitHub config for js-precompiled" +echo "*** [v1 precompiled] Setting up GitHub config for js-precompiled" rm -rf ./.git git init setup_git_user -echo "*** [v1] Checking out $PRECOMPILED_BRANCH branch" +echo "*** [v1 precompiled] Checking out $PRECOMPILED_BRANCH branch" git remote add origin $GIT_JS_PRECOMPILED git fetch origin 2>$GITLOG git checkout -b $PRECOMPILED_BRANCH -echo "*** [v1] Committing compiled files for $UTCDATE" +echo "*** [v1 precompiled] Committing compiled files for $UTCDATE" mv build ../build.new git add . git commit -m "$UTCDATE [update]" @@ -44,33 +43,10 @@ mv ../build.new build git add . git commit -m "$UTCDATE [release]" -echo "*** [v1] Merging remote" +echo "*** [v1 precompiled] Merging remote" git push origin HEAD:refs/heads/$PRECOMPILED_BRANCH 2>$GITLOG -PRECOMPILED_HASH=`git rev-parse HEAD` # move to root -cd ../.. - -echo "*** [v1] Setting up GitHub config for parity" -setup_git_user -git remote set-url origin $GIT_PARITY -git reset --hard origin/$BRANCH 2>$GITLOG - -echo "*** [v1] Updating cargo parity-ui-old-precompiled#$PRECOMPILED_HASH" -git submodule update -# Not needed since $BRANCH is hardcoded -# sed -i "/^parity-ui-old-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml -cargo update -p parity-ui-old-precompiled -# --precise "$PRECOMPILED_HASH" - -echo "*** [v1] Committing updated files" -git add dapps/ui/Cargo.toml -git add Cargo.lock -git commit -m "[ci skip] js-precompiled $UTCDATE" -git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG - -# back to root -echo "*** [v1] Release completed" popd # exit with exit code diff --git a/js-old/scripts/test.js b/js-old/scripts/test.js index e426642db0b..e60e3cb6c7a 100644 --- a/js-old/scripts/test.js +++ b/js-old/scripts/test.js @@ -1 +1 @@ -// test script 10 +// test script 11 diff --git a/js/scripts/push-cargo.sh b/js/scripts/push-cargo.sh new file mode 100644 index 00000000000..25b284adb8b --- /dev/null +++ b/js/scripts/push-cargo.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +# variables +UTCDATE=`date -u "+%Y%m%d-%H%M%S"` +BRANCH=$CI_BUILD_REF_NAME +GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/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` +pushd $BASEDIR + +echo "*** [cargo] Setting up GitHub config for parity" +setup_git_user +git remote set-url origin $GIT_PARITY +git reset --hard origin/$BRANCH 2>$GITLOG +git submodule update + +if [ "$BRANCH" == "master" ]; then + cd js + + echo "*** [cargo] Bumping package.json patch version" + npm --no-git-tag-version version + npm version patch + + cd .. + + git add js +fi + +echo "*** [cargo] Updating cargo parity-ui-precompiled" +sed -i "/^parity-ui-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml +cargo update -p parity-ui-precompiled +cargo update -p parity-ui-old-precompiled + +echo "*** [cargo] Committing updated files" +git add dapps/ui/Cargo.toml +git add Cargo.lock +git commit -m "[ci skip] js-precompiled $UTCDATE" +git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG + +# back to root +echo "*** [cargo] Release completed" +popd + +# exit with exit code +exit 0 diff --git a/js/scripts/push-precompiled.sh b/js/scripts/push-precompiled.sh new file mode 100755 index 00000000000..306152eb0f3 --- /dev/null +++ b/js/scripts/push-precompiled.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -e + +# variables +UTCDATE=`date -u "+%Y%m%d-%H%M%S"` +BRANCH=$CI_BUILD_REF_NAME +GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.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 "*** [v2 precompiled] Setting up GitHub config" +rm -rf ./.git +git init +setup_git_user + +echo "*** [v2 precompiled] Checking out $BRANCH branch" +git remote add origin $GIT_JS_PRECOMPILED +git fetch origin 2>$GITLOG +git checkout -b $BRANCH + +echo "*** [v2 precompiled] Committing compiled files for $UTCDATE" +mv build ../build.new +git add . +git commit -m "$UTCDATE [update]" +git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [merge]" +git rm -r build +rm -rf build +git commit -m "$UTCDATE [cleanup]" +mv ../build.new build +git add . +git commit -m "$UTCDATE [release]" + +echo "*** [v2 precompiled] Merging remote" +git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG + +popd + +# exit with exit code +exit 0 diff --git a/js/scripts/release.sh b/js/scripts/release.sh deleted file mode 100755 index 158bbf7b48a..00000000000 --- a/js/scripts/release.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -set -e - -# variables -UTCDATE=`date -u "+%Y%m%d-%H%M%S"` -BRANCH=$CI_BUILD_REF_NAME -GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git" -GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/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 "*** [v2] Setting up GitHub config for js-precompiled" -rm -rf ./.git -git init -setup_git_user - -echo "*** [v2] Checking out $BRANCH branch" -git remote add origin $GIT_JS_PRECOMPILED -git fetch origin 2>$GITLOG -git checkout -b $BRANCH - -echo "*** [v2] Committing compiled files for $UTCDATE" -mv build ../build.new -git add . -git commit -m "$UTCDATE [update]" -git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [merge]" -git rm -r build -rm -rf build -git commit -m "$UTCDATE [cleanup]" -mv ../build.new build -git add . -git commit -m "$UTCDATE [release]" - -echo "*** [v2] Merging remote" -git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG -PRECOMPILED_HASH=`git rev-parse HEAD` - -# move to root -cd ../.. - -echo "*** [v2] Setting up GitHub config for parity" -setup_git_user -git remote set-url origin $GIT_PARITY -git reset --hard origin/$BRANCH 2>$GITLOG - -if [ "$BRANCH" == "master" ]; then - cd js - - echo "*** [v2] Bumping package.json patch version" - npm --no-git-tag-version version - npm version patch - - cd .. -fi - -echo "*** [v2] Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH" -git submodule update -sed -i "/^parity-ui-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml -cargo update -p parity-ui-precompiled -# --precise "$PRECOMPILED_HASH" - -echo "*** [v2] Committing updated files" -git add js -git add dapps/ui/Cargo.toml -git add Cargo.lock -git commit -m "[ci skip] js-precompiled $UTCDATE" -git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG - -# back to root -echo "*** [v2] Release completed" -popd - -# exit with exit code -exit 0 diff --git a/js/scripts/test.js b/js/scripts/test.js index 1eeedca9fc1..f4251694ad0 100644 --- a/js/scripts/test.js +++ b/js/scripts/test.js @@ -1 +1 @@ -// test script 15 +// test script 16