diff --git a/.travis.yml b/.travis.yml index 7861f667..b727d220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ before_deploy: - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 - export PATH="$HOME/.yarn/bin:$PATH" - RELEASE_TAG=$TRAVIS_TAG ./scripts/release.sh -- RELEASE_TAG=$TRAVIS_TAG ./scripts/publish.sh deploy: provider: releases diff --git a/package.json b/package.json index d7df78f5..61d9948e 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "postcss-loader": "^3.0.0", "rimraf": "^2.6.3", "sass-loader": "^7.1.0", + "semver": "^6.0.0", "style-loader": "^0.23.1", "stylus": "^0.54.5", "stylus-loader": "^3.0.2", diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100755 index 1c8bc7da..00000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e -mkdir dist -cd dist -cp ../blessing-skin-server-$RELEASE_TAG.zip blessing-skin-server-$RELEASE_TAG.zip -echo "{\"spec\":1,\"latest\":\"$RELEASE_TAG\",\"url\":\"https://dev.azure.com/blessing-skin/51010f6d-9f99-40f1-a262-0a67f788df32/_apis/git/repositories/a9ff8df7-6dc3-4ff8-bb22-4871d3a43936/Items?path=%2Fblessing-skin-server-$RELEASE_TAG.zip\"}" > update.json -git init -git add . -git commit -m "Publish" -git remote add origin https://blessing-skin:$AZURE_TOKEN@dev.azure.com/blessing-skin/Blessing%20Skin%20Server/_git/Blessing%20Skin%20Server -git push -f origin master diff --git a/scripts/release.sh b/scripts/release.sh index 2d72f833..6355f880 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -22,3 +22,13 @@ zip -9 -r blessing-skin-server-$RELEASE_TAG.zip \ LICENSE \ README.md \ README_EN.md + +mkdir dist +cd dist +cp ../blessing-skin-server-$RELEASE_TAG.zip blessing-skin-server-$RELEASE_TAG.zip +echo "{\"spec\":1,\"latest\":\"$RELEASE_TAG\",\"url\":\"https://dev.azure.com/blessing-skin/51010f6d-9f99-40f1-a262-0a67f788df32/_apis/git/repositories/a9ff8df7-6dc3-4ff8-bb22-4871d3a43936/Items?path=%2Fblessing-skin-server-$RELEASE_TAG.zip\"}" > update.json +git init +git add . +git commit -m "Publish" +git remote add origin https://blessing-skin:$AZURE_TOKEN@dev.azure.com/blessing-skin/Blessing%20Skin%20Server/_git/Blessing%20Skin%20Server +git push -f origin master diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 00000000..6dad9c16 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +CURRENT=$(cat package.json | grep -P '\d+\.\d+\.\d+' -o | head -n 1) +NEW_VERSION=$(./node_modules/.bin/semver -i $1 $CURRENT) +sed -i "0,/$CURRENT/s/$CURRENT/$NEW_VERSION/" package.json config/app.php +git add package.json config/app.php +git commit -m "Bump version to $NEW_VERSION" +git tag -a $NEW_VERSION -m $NEW_VERSION +git push --follow-tags origin master diff --git a/yarn.lock b/yarn.lock index 3a952562..f62b9892 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8039,6 +8039,11 @@ semver@^5.5, semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== +semver@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" + integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== + semver@~5.3.0: version "5.3.0" resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"