diff --git a/.travis.yml b/.travis.yml index eaccbd0..88c7754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: install: - pip install -r factory/requirements.txt -- apt-get install nodejs +- sudo apt-get install nodejs - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc before_script: @@ -22,17 +22,24 @@ script: - python factory/configs.py after_success: -# deploy assets +# stage assets - git add -A 'plates/*' - git add -A 'showcase/*' - git add -A 'configs/*' + +# publish configs +- > + find configs -name 'publish.sh' | + xargs -I{} bash -c + 'cd $(dirname {}); git diff --cached --quiet . || (echo {}; bash publish.sh)' +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# └─ Check if this directory has been changed. + +# deploy assets - git commit -m 'Generate assets in Travis CI [ci skip]' - git remote add deploy "https://$GITHUB_TOKEN@github.com/sublee/sublette.git" - git push deploy "$TRAVIS_BRANCH" -# deploy configs -- find configs -name 'deploy.sh' | xargs -I{} bash -c 'cd $(dirname {}) && bash deploy.sh' - branches: only: - master diff --git a/configs/Hyper/package.json b/configs/Hyper/package.json index c77a1b3..eb90b6d 100644 --- a/configs/Hyper/package.json +++ b/configs/Hyper/package.json @@ -1,5 +1,6 @@ { - "name": "hyper-sublette", + "name": "hyper-sublette-test", + "version": "#VERSION#", "description": "Sublette for Hyper", "author": "Heungsub Lee (https://subl.ee/)", "license": "MIT", diff --git a/configs/Hyper/publish.sh b/configs/Hyper/publish.sh new file mode 100644 index 0000000..5a1fd33 --- /dev/null +++ b/configs/Hyper/publish.sh @@ -0,0 +1,10 @@ +PREV_VERSION="$(npm show hyper-sublette-test version 2>/dev/null || echo 0.0.0)" + +MAJOR="$(echo "$PREV_VERSION" | awk -F. '{ print $1 }')" +MINOR="$(echo "$PREV_VERSION" | awk -F. '{ print $2 }')" +PATCH="$(echo "$PREV_VERSION" | awk -F. '{ print $3 }')" + +VERSION="$MAJOR.$MINOR.$((PATCH+1))" +sed -i "s/#VERSION#/$VERSION/g" package.json + +npm publish diff --git a/factory/configs/Hyper/deploy.sh b/factory/configs/Hyper/deploy.sh deleted file mode 100644 index a3434e7..0000000 --- a/factory/configs/Hyper/deploy.sh +++ /dev/null @@ -1,13 +0,0 @@ -if git diff --quiet . -then - PREV_VERSION="$(npm show hyper-sublette version 2>/dev/null || echo 0.0.0)" - - MAJOR="$(echo "$PREV_VERSION" | awk -F. '{ print $1 }')" - MINOR="$(echo "$PREV_VERSION" | awk -F. '{ print $2 }')" - PATCH="$(echo "$PREV_VERSION" | awk -F. '{ print $3 }')" - - VERSION="$MAJOR.$MINOR.$((PATCH+1))" - sed -i "s/#VERSION#/$VERSION/g" package.json - - npm publish -fi diff --git a/factory/configs/Hyper/publish.sh b/factory/configs/Hyper/publish.sh new file mode 100644 index 0000000..3fb1ecd --- /dev/null +++ b/factory/configs/Hyper/publish.sh @@ -0,0 +1,11 @@ +# Publish hyper-sublette to NPM. +PREV_VERSION="$(npm show hyper-sublette version 2>/dev/null || echo 0.0.0)" + +MAJOR="$(echo "$PREV_VERSION" | awk -F. '{ print $1 }')" +MINOR="$(echo "$PREV_VERSION" | awk -F. '{ print $2 }')" +PATCH="$(echo "$PREV_VERSION" | awk -F. '{ print $3 }')" + +VERSION="$MAJOR.$MINOR.$((PATCH+1))" +sed -i "s/#VERSION#/$VERSION/g" package.json + +npm publish