From 3d85451aff331ad645527ac95104a744fed016e1 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 9 Sep 2019 13:05:52 +0200 Subject: [PATCH 1/3] Update version to 0.5.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 38daec284..4e7aa2380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@human-connection/styleguide", - "version": "0.5.20", + "version": "0.5.21", "private": false, "scripts": { "serve": "http-server ./docs -o -s", From 90f747a2a9432e36c62047916e42cf8403a42255 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 9 Sep 2019 13:46:47 +0200 Subject: [PATCH 2/3] Don't deploy if you're not on `master` Thank you: https://github.com/travis-ci/travis-ci/issues/5419#issuecomment-222815942 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 552534b66..e514fc37a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,11 @@ deploy: api_key: $NPM_TOKEN on: tags: true - branch: master + condition: $(git branch --contains $TRAVIS_TAG | grep -l '^[\* ] master$') - provider: pages skip_cleanup: true github_token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable keep_history: true on: tags: true - branch: master + condition: $(git branch --contains $TRAVIS_TAG | grep -l '^[\* ] master$') From b05583a8b0d1072a971fe5cdd5a419ee100925e3 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 9 Sep 2019 14:40:55 +0200 Subject: [PATCH 3/3] Implement a custom deployment condition via bash --- .travis.yml | 7 +++---- deployment_condition.sh | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100755 deployment_condition.sh diff --git a/.travis.yml b/.travis.yml index e514fc37a..5095460ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,18 +15,17 @@ before_deploy: - rm -Rf ./node_modules .docs ./preview ./tests *.log* - rm -Rf ./src/system/icons/_all - rm -Rf ./src/system/tokens/_examples + deploy: - provider: npm skip_cleanup: true email: $NPM_EMAIL api_key: $NPM_TOKEN on: - tags: true - condition: $(git branch --contains $TRAVIS_TAG | grep -l '^[\* ] master$') + condition: ./deployment_condition.sh - provider: pages skip_cleanup: true github_token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable keep_history: true on: - tags: true - condition: $(git branch --contains $TRAVIS_TAG | grep -l '^[\* ] master$') + condition: ./deployment_condition.sh diff --git a/deployment_condition.sh b/deployment_condition.sh new file mode 100755 index 000000000..ff5658916 --- /dev/null +++ b/deployment_condition.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +BRANCH=$(git rev-parse --abbrev-ref HEAD) + +if [ "$BRANCH" != "master" ]; then + exit 1 +fi + +CURRENT_VERSION=$(cat package.json | jq -r .version) +PUBLISHED_VERSION=$(yarn info @human-connection/styleguide version --silent) + +if [ "$CURRENT_VERSION" == "$PUBLISHED_VERSION" ]; then + exit 1 +fi + + +exit 0