2
0
Эх сурвалжийг харах

PR should build but not deploy

Baptiste Augrain 4 жил өмнө
parent
commit
3e50a25606

+ 9 - 4
.github/workflows/linux.yml

@@ -42,6 +42,10 @@ jobs:
       - name: Install Yarn
         run: npm install -g yarn
 
+      - name: Check PR or cron
+        run: |
+          . check_cron_or_pr.sh
+
       - name: Clone VSCode repo
         run: ./get_repo.sh
 
@@ -49,6 +53,7 @@ jobs:
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: ./check_tags.sh
+        if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Build
         env:
@@ -61,15 +66,15 @@ jobs:
         run: |
           cd VSCode-linux-${VSCODE_ARCH}
           tar czf ../VSCodium-linux-${VSCODE_ARCH}-${LATEST_MS_TAG}.tar.gz .
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Generate shasums
         run: ./sum.sh
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
       
       - name: Release
         uses: softprops/action-gh-release@v1
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         with:
           tag_name: ${{ env.LATEST_MS_TAG }}
           files: |
@@ -84,7 +89,7 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Update versions repo
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         run: ./update_version.sh
         env:
           GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}

+ 11 - 6
.github/workflows/macos.yml

@@ -21,6 +21,10 @@ jobs:
         with:
           node-version: 12.14.1
           
+      - name: Check PR or cron
+        run: |
+          . check_cron_or_pr.sh
+
       - name: Clone VSCode repo
         run: |
           . get_repo.sh
@@ -30,6 +34,7 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
           . check_tags.sh
+        if: env.SHOULD_DEPLOY == 'yes'
           
       - name: Build
         env:
@@ -42,7 +47,7 @@ jobs:
           CERTIFICATE_OSX_P12: ${{ secrets.CERTIFICATE_OSX_P12 }}
           CERTIFICATE_OSX_PASSWORD: ${{ secrets.CERTIFICATE_OSX_PASSWORD }}
           CERTIFICATE_OSX_ID: ${{ secrets.CERTIFICATE_OSX_ID }}
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         run: |
           if [ -d "VSCode-darwin-${VSCODE_ARCH}" ]; then # just in case the build failed
             cd "VSCode-darwin-${VSCODE_ARCH}"
@@ -61,7 +66,7 @@ jobs:
         run: |
           cd "VSCode-darwin-${VSCODE_ARCH}"
           zip -r -X -y ../VSCodium-darwin-${VSCODE_ARCH}-${LATEST_MS_TAG}.zip ./*.app
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: DMG the release
         run: |
@@ -69,15 +74,15 @@ jobs:
           npx create-dmg VSCodium.app ..
           mv "../VSCodium ${LATEST_MS_TAG}.dmg" "../VSCodium.${VSCODE_ARCH}.${LATEST_MS_TAG}.dmg"
           popd
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Generate shasums
         run: ./sum.sh
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
       
       - name: Release
         uses: softprops/action-gh-release@v1
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         with:
           tag_name: ${{ env.LATEST_MS_TAG }}
           files: |
@@ -88,7 +93,7 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Update versions repo
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         run: ./update_version.sh
         env:
           GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}

+ 9 - 4
.github/workflows/windows.yml

@@ -34,6 +34,10 @@ jobs:
         with:
           python-version: '2.x'
 
+      - name: Check PR or cron
+        run: |
+          . check_cron_or_pr.sh
+
       - name: Clone VSCode repo
         run: ./get_repo.sh
         shell: bash
@@ -43,6 +47,7 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: ./check_tags.sh
         shell: bash
+        if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Build
         env:
@@ -59,16 +64,16 @@ jobs:
           mv vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe VSCodiumUserSetup-${VSCODE_ARCH}-${LATEST_MS_TAG}.exe
           mv vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip VSCodium-win32-${VSCODE_ARCH}-${LATEST_MS_TAG}.zip
         shell: bash
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Generate shasums
         run: ./sum.sh
         shell: bash
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
       
       - name: Release
         uses: softprops/action-gh-release@v1
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         with:
           tag_name: ${{ env.LATEST_MS_TAG }}
           files: |
@@ -80,7 +85,7 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Update versions repo
-        if: env.SHOULD_BUILD == 'yes'
+        if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
         run: ./update_version.sh
         shell: bash
         env:

+ 17 - 0
check_cron_or_pr.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+if [[ $github.event.number ]]; then
+	# it's a PR
+	
+	export SHOULD_BUILD="yes"
+	export SHOULD_DEPLOY="no"
+else
+	export SHOULD_DEPLOY="yes"
+fi
+
+if [[ $GITHUB_ENV ]]; then
+	echo "SHOULD_BUILD=$SHOULD_BUILD" >> $GITHUB_ENV
+	echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
+fi

+ 0 - 2
build_macos.sh → scripts/build_macos.sh

@@ -1,7 +1,5 @@
 #!/bin/bash
 
-nvm use 12
-
 rm -rf VSCode*
 rm -rf vscode