Преглед изворни кода

ci: move docs deploy logic out of build script (#9108)

Yihau Chen пре 4 дана
родитељ
комит
1dcfb9a0c4
3 измењених фајлова са 23 додато и 12 уклоњено
  1. 6 0
      .github/workflows/docs.yml
  2. 0 12
      docs/build.sh
  3. 17 0
      docs/deploy.sh

+ 6 - 0
.github/workflows/docs.yml

@@ -89,6 +89,12 @@ jobs:
         run: |
         run: |
           npm install
           npm install
           ./build.sh
           ./build.sh
+
+      - name: Deploy
+        if: ${{ github.event_name == 'push' }}
+        working-directory: docs
+        run: |
+          ./deploy.sh
         env:
         env:
           VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
           VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
           VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }}
           VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }}

+ 0 - 12
docs/build.sh

@@ -15,15 +15,3 @@ source ../ci/rust-version.sh
 # Build from /src into /build
 # Build from /src into /build
 npm run build
 npm run build
 echo $?
 echo $?
-
-# Publish only from merge commits and beta release tags
-if [[ -n $CI ]]; then
-  if [[ -z $CI_PULL_REQUEST ]]; then
-    eval "$(../ci/channel-info.sh)"
-    if [[ -n $CI_TAG ]] && [[ $CI_TAG != $BETA_CHANNEL* ]]; then
-      echo "not a beta tag"
-      exit 0
-    fi
-    ./publish-docs.sh
-  fi
-fi

+ 17 - 0
docs/deploy.sh

@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+cd "$(dirname "$0")"
+
+# Publish only from merge commits and beta release tags
+if [[ -n $CI ]]; then
+  if [[ -z $CI_PULL_REQUEST ]]; then
+    eval "$(../ci/channel-info.sh)"
+    if [[ -n $CI_TAG ]] && [[ $CI_TAG != $BETA_CHANNEL* ]]; then
+      echo "not a beta tag"
+      exit 0
+    fi
+    ./publish-docs.sh
+  fi
+fi