Yuki Takei 9 лет назад
Родитель
Сommit
ae99997141
2 измененных файлов с 36 добавлено и 14 удалено
  1. 1 1
      package.json
  2. 35 13
      wercker.yml

+ 1 - 1
package.json

@@ -36,7 +36,7 @@
     "server": "npm run server:dev:watch",
     "start": "npm run server:prod",
     "test": "mocha -r test/bootstrap.js test/**/*.js",
-    "version": "node -p require('./package.json').version",
+    "version": "node -p \"require('./package.json').version\"",
     "webpack": "webpack"
   },
   "dependencies": {

+ 35 - 13
wercker.yml

@@ -81,27 +81,49 @@ build-dev:
         npm run build:dev
 
 
-release-to-github: # would be run on release branch
+create-branch-for-release: # would be run on release branch
   steps:
     - script:
-      name: set yarn cache-folder
-      code: yarn config set cache-folder $WERCKER_CACHE_DIR/yarn
+      name: bump version
+      code: |
+        git config --global user.name "wercker"
+        git config --global user.email "info@weseek.co.jp"
+        # npm version to bump version
+        npm version patch
+        # export $RELEASE_VERSION
+        export RELEASE_VERSION=`npm run version --silent`
+        echo "export RELEASE_VERSION=$RELEASE_VERSION"
 
     - script:
-      name: install dependencies
+      name: push to github to create new branch
       code: |
-        yarn global add npm@4
-        # add assets-webpack-plugin individually
-        # because `yarn install` couldn't find package from the "npm" registry
-        yarn add assets-webpack-plugin
-        yarn install --production
+        # reconfigure origin
+        GITHUB_ORIGIN=https://yuki-takei:$GITHUB_TOKEN@$WERCKER_GIT_DOMAIN/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
+        git remote set-url origin $GITHUB_ORIGIN
+        git checkout -B tmp/release-$RELEASE_VERSION
+        git push -u origin HEAD:tmp/release-$RELEASE_VERSION
+
 
+release-to-github: # would be run on temporary release branch
+  steps:
     - script:
-      name: bump version
+      name: get version
       code: |
-        npm version patch
-        RELEASE_VERSION=`npm run version --silent`
+        export RELEASE_VERSION=`npm run version --silent`
+        echo "export RELEASE_VERSION=$RELEASE_VERSION"
 
     - github-create-release:
       token: $GITHUB_TOKEN
-      tag: $RELEASE_VERSION
+      tag: v$RELEASE_VERSION
+
+    - script:
+      name: remove temporary release branch
+      code: |
+        git config --global user.name "wercker"
+        git config --global user.email "info@weseek.co.jp"
+        # reconfigure origin
+        GITHUB_ORIGIN=https://yuki-takei:$GITHUB_TOKEN@$WERCKER_GIT_DOMAIN/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
+        git remote rm origin
+        git remote add origin $GITHUB_ORIGIN
+        # remove branch
+        git push --delete origin $WERCKER_GIT_BRANCH