Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

ci: fix ci (#519)

白熱9028d805e669
diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml
index 4b7839238d..69e68222b9 100644
--- a/.github/workflows/preview-build.yml
+++ b/.github/workflows/preview-build.yml
@@ -12,13 +12,11 @@ jobs:
if: github.repository == 'dream-num/univer'
runs-on: ubuntu-latest
- env:
- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- TURBO_TEAM: ${{ vars.TURBO_TEAM }}
-
steps:
- name: Checkout
uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.ref.outputs.ref }}
- name: Install Node.js
uses: actions/setup-node@v3
@@ -50,33 +48,6 @@ jobs:
- name: 📦 Build
run: pnpm run build
- # build demo
- - name: 📦 Build demo
- run: pnpm run build:demo
-
- - name: Copy demo to workspace
- run: |
- mkdir .workspace
- cp -r ./examples/univer-doc-ts/local .workspace/doc
- cp -r ./examples/univer-sheet-ts/local .workspace/sheet
- cp -r ./examples/univer-slide-ts/local .workspace/slide
-
- - name: Save demo cache
- uses: actions/cache/save@v3
- with:
- path: .workspace
- key: ${{ runner.os }}-demo-${{ github.event.pull_request.number }}
-
- # build storybook
- - name: 📦 Build storybook
- run: pnpm run build:storybook
-
- - name: Save storybook cache
- uses: actions/cache/save@v3
- with:
- path: storybook-static
- key: ${{ runner.os }}-storybook-${{ github.event.pull_request.number }}
-
set-pr-id:
name: Set PR ID
runs-on: ubuntu-latest
@@ -85,6 +56,7 @@ jobs:
if: ${{ always() }}
run: |
echo ${{ github.event.pull_request.number }} > ./pr-id.txt
+ echo ${{ github.head_ref }} >> ./pr-ref.txt
- name: Upload PR number
if: ${{ always() }}
@@ -92,3 +64,10 @@ jobs:
with:
name: pr-id
path: ./pr-id.txt
+
+ - name: Upload PR ref
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: pr-ref
+ path: ./pr-ref.txt
diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml
index d8460f5565..903ea9452a 100644
--- a/.github/workflows/preview-deploy.yml
+++ b/.github/workflows/preview-deploy.yml
@@ -15,6 +15,10 @@ jobs:
if: github.repository == 'dream-num/univer'
runs-on: ubuntu-latest
+ env:
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: ${{ vars.TURBO_TEAM }}
+
steps:
# Get PR ID from artifact
- name: download pr artifact
@@ -24,18 +28,63 @@ jobs:
run_id: ${{ github.event.workflow_run.id }}
name: pr-id
- - name: save PR id
+ - name: get PR id
id: pr
run: echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
+ # Get PR ID from artifact
+ - name: download pr artifact
+ uses: dawidd6/action-download-artifact@v2
+ with:
+ workflow: ${{ github.event.workflow_run.workflow_id }}
+ run_id: ${{ github.event.workflow_run.id }}
+ name: pr-ref
+
+ - name: get PR ref
+ id: ref
+ run: echo "ref=$(<pr-ref.txt)" >> $GITHUB_OUTPUT
+
- name: Checkout
uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.ref.outputs.ref }}
- - name: Restore demo cache
- uses: actions/cache/restore@v3
+ - name: Install Node.js
+ uses: actions/setup-node@v3
with:
- path: .workspace
- key: ${{ runner.os }}-demo-${{ steps.pr.outputs.id }}
+ node-version: 18
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+ run_install: false
+
+ - name: Get pnpm store directory
+ shell: bash
+ run: |
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+ - name: Setup pnpm cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ env.STORE_PATH }}
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-pnpm-
+
+ - name: Install dependencies
+ run: pnpm install
+
+ # ================= Deploy Demo =================
+ - name: 📦 Build demo
+ run: pnpm run build:demo
+
+ - name: Copy demo to workspace
+ run: |
+ mkdir .workspace
+ cp -r ./examples/univer-doc-ts/local .workspace/doc
+ cp -r ./examples/univer-sheet-ts/local .workspace/sheet
- name: 🚀 Deploy to Vercel (demo)
uses: amondnet/vercel-action@v25
@@ -45,11 +94,9 @@ jobs:
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID}}
- - name: Restore storybook cache
- uses: actions/cache/restore@v3
- with:
- path: storybook-static
- key: ${{ runner.os }}-storybook-${{ steps.pr.outputs.id }}
+ # ================= Deploy Storybook =================
+ - name: 📦 Build storybook
+ run: pnpm run build:storybook
- name: 🚀 Deploy to Vercel (storybook)
uses: amondnet/vercel-action@v25
@@ -59,6 +106,7 @@ jobs:
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK}}
+ # ================= Notify Discord =================
- name: 👾 Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
@@ -94,6 +142,7 @@ jobs:
color: 0xd63031
username: GitHub Actions
+ # ================= Create Comment =================
- name: 🧽 Find And Delete Comment
uses: peter-evans/find-comment@v2
id: fc