Add script for bumping version

This commit is contained in:
Pig Fang 2019-04-20 16:02:05 +08:00
parent d01ca18431
commit e2594c2ab7
6 changed files with 25 additions and 12 deletions

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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

9
scripts/version.sh Executable file
View File

@ -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

View File

@ -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"