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

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

Yihau Chen 4 өдөр өмнө
parent
commit
1dcfb9a0c4

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

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

+ 0 - 12
docs/build.sh

@@ -15,15 +15,3 @@ source ../ci/rust-version.sh
 # Build from /src into /build
 npm run build
 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