2
0
Peter Squicciarini 7 жил өмнө
parent
commit
206f1e77e2
6 өөрчлөгдсөн 63 нэмэгдсэн , 30 устгасан
  1. 11 8
      .travis.yml
  2. 14 11
      build.sh
  3. 18 0
      check_tags.sh
  4. 10 8
      create_zip.sh
  5. 8 0
      get_repo.sh
  6. 2 3
      install_deps.sh

+ 11 - 8
.travis.yml

@@ -1,12 +1,16 @@
-if: tag IS present
+matrix:
+  include:
+    - os: linux
+      sudo: required
+    - os: osx
 
-os:
-  - osx
-  - linux
+language: node_js
+node_js: "8"
 
 before_install:
   - ./install_deps.sh
-  - git clone https://github.com/Microsoft/vscode.git
+  - . get_repo.sh
+  - . check_tags.sh
 
 script:
   - ./build.sh
@@ -17,9 +21,8 @@ before_deploy:
 deploy:
   provider: releases
   skip_cleanup: true
-  api_key:
-    secure: DKYMvOsXNwFDFoqiNDIt8g/5w/BcCHg7ieY6lAJU0Hu2V7san/gqJGG2asKPNBQpCoiWzdIjyCqlZFhWiZpKmEN560bALAcO0fPQXnRum/mACYPDcO/OZrK2F/muJyy1r5l9SseL9SmkAGdBilXO2kfvquH9wQD7/Zb1djLMclUctb84POtl2Nr1u6y0OxftOTANcIh9qbRO2Tdk3kvH8khvHv3dRo8RU6zoq1xxY5sLpeFDXPThGeBVfU2KV6b/hfLUrvIlX20zVRuDmgBMp73xD+K+9yZeXwaoiB2HxGlDmtYhBEhWG47a3IOgvXPfLjAiRSNfHSfESCHcQZ5piQhRfEIGlpMPaSXF3AORNxy3OnSUE7WyIuKWXFpOlgxho7uARl1lrrln8ySVvuqLdYG5VSK+2BdZnwSjr1Lem2WqVaYKMBDHuqCEHZzpWFvG/ehhzfFWcEmQRXyVksShnAz517OcZmMKYreICCnf7qCrpe5QNN1M/Tz60L2XgsnwGGT1o5fj68Ho1gtXl1+AHC0QVULO2LszrFMh1hRUOckgNQ6THDUrZGbX3t36GmtUfPHaE1Fn9yKH28HX86A7KlwqvEKUmkMKnNcZfdA5alQfS75a2S4sxYSEpR1hTFO+w7cZTTu+SJHCWu+gP5dpr2q0oNJfKngkVUMt7V8tbn0=
+  api_key: $GITHUB_TOKEN
   file_glob: true
   file: ./*.zip
   on:
-    tag: true
+    condition: "$SHOULD_BUILD = yes"

+ 14 - 11
build.sh

@@ -1,15 +1,18 @@
 #!/bin/bash
 
-cd vscode
-yarn
-mv product.json product.json.bak
-cat product.json.bak | jq 'setpath(["extensionsGallery"]; {"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", "itemUrl": "https://marketplace.visualstudio.com/items"})' > product.json
-export NODE_ENV=production
+if [[ "$SHOULD_BUILD" == "yes" ]]; then
+  cd vscode
+  yarn
+  mv product.json product.json.bak
+  cat product.json.bak | jq 'setpath(["extensionsGallery"]; {"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", "itemUrl": "https://marketplace.visualstudio.com/items"})' > product.json
+  cat product.json
+  export NODE_ENV=production
 
-if [[ "$TRAVIS_OS_NAME" === "osx" ]]; then
-  npx gulp vscode-darwin-min
-else
-  npx gulp vscode-linux-x64-min
-fi
+  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+    npx gulp vscode-darwin-min
+  else
+    npx gulp vscode-linux-x64-min
+  fi
 
-cd ..
+  cd ..
+fi

+ 18 - 0
check_tags.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if git rev-parse $LATEST_MS_TAG >/dev/null 2>&1
+then
+    echo "Latest MS tag ${LATEST_MS_TAG} already exists in VSCodium. Bail"
+else
+    echo "New MS tag found, continuing build"
+    if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
+      echo $LATEST_MS_TAG > version.md
+      git config --local user.name "Travis CI"
+      git config --local user.email "builds@travis-ci.com"
+      git add version.md
+      git commit -m "${LATEST_MS_TAG}"
+      git tag $LATEST_MS_TAG
+      git push --quiet https://$GITHUB_TOKEN@github.com/VSCodium/vscodium master --tags > /dev/null 2>&1
+    fi
+    export SHOULD_BUILD="yes"
+fi

+ 10 - 8
create_zip.sh

@@ -1,11 +1,13 @@
 #!/bin/bash
 
-if [[ "$TRAVIS_OS_NAME" === "osx" ]]; then
-  cd VSCode-darwin
-  zip -r ../VSCode-darwin-${TRAVIS_TAG}.zip ./*
-else
-  cd VSCode-linux-x64
-  zip -r ../VSCode-linux-x64-${TRAVIS_TAG}.zip ./*
-fi
+if [[ "$SHOULD_BUILD" == "yes" ]]; then
+  if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+    cd VSCode-darwin
+    zip -r ../VSCode-darwin-${LATEST_MS_TAG}.zip ./*
+  else
+    cd VSCode-linux-x64
+    zip -r ../VSCode-linux-x64-${LATEST_MS_TAG}.zip ./*
+  fi
 
-cd ..
+  cd ..
+fi

+ 8 - 0
get_repo.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+git clone https://github.com/Microsoft/vscode.git
+cd vscode
+export LATEST_MS_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
+echo "Got the latest MS tag: ${LATEST_MS_TAG}"
+git checkout $LATEST_MS_TAG
+cd ..

+ 2 - 3
install_deps.sh

@@ -2,9 +2,8 @@
 
 if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
   brew update
-  brew install node python yarn jq zip
+  brew install yarn --without-node
+  brew install jq zip
 else
   sudo apt-get install libx11-dev libxkbfile-dev libsecret-1-dev fakeroot rpm
-  nvm install 8
-  nvm use 8
 fi