Просмотр исходного кода

testing release-to-github pipeline

Yuki Takei 9 лет назад
Родитель
Сommit
174b4c6a29
1 измененных файлов с 26 добавлено и 14 удалено
  1. 26 14
      wercker.yml

+ 26 - 14
wercker.yml

@@ -81,37 +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
-
-    # - script:
-    #   name: install dependencies
-    #   code: |
-    #     yarn global add npm@4
-    #     yarn install --production
-
     - script:
       name: bump version
       code: |
-        # npm version to bump version
         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: push to github
+      name: push to github to create new branch
       code: |
+        # 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
-        git push origin HEAD:release
+        git push -u origin HEAD:tmp/release-$RELEASE_VERSION
+
+
+release-to-github: # would be run on temporary release branch
+  steps:
+    - script:
+      name: get version
+      code: |
+        export RELEASE_VERSION=`npm run version --silent`
+        echo "export RELEASE_VERSION=$RELEASE_VERSION"
 
     - github-create-release:
       token: $GITHUB_TOKEN
       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