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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
ci: migrate vercel deployments to github pages
白熱b6bf623884a7
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.ymlindex a5a35180ea..c1f93bbfda 100644--- a/.github/workflows/e2e.yml+++ b/.github/workflows/e2e.yml@@ -45,21 +45,12 @@ jobs:- name: Run Playwright Testsrun: pnpm exec playwright test- - name: 🚀 Deploy to Vercel- uses: amondnet/vercel-action@v25- if: failure()- id: vercel-e2e-report # we only need to upload to Vercel if this CI fails- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID_E2E }}-- name: Write Playwright Report to PR Commentuses: daun/playwright-report-summary@v3if: always()with:report-file: playwright-report.json- custom-info: 'For more information, [see full report](${{ steps.vercel-e2e-report.outputs.preview-url }})'+ custom-info: 'For more information, [see full report and artifacts](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }})'- name: Upload Artifactuses: actions/upload-artifact@v4diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.ymlnew file mode 100644index 0000000000..3c5a38b309--- /dev/null+++ b/.github/workflows/pages.yml@@ -0,0 +1,66 @@+name: 🌐 Deploy to GitHub Pages++on:+ push:+ branches: [dev]+ tags:+ - 'v*.*.*'+ - 'v*.*.*-alpha.*'+ - 'v*.*.*-beta.*'+ - 'v*.*.*-rc.*'++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++permissions:+ contents: write++jobs:+ deploy:+ runs-on: ubuntu-latest++ steps:+ - name: Checkout+ uses: actions/checkout@v4+ with:+ persist-credentials: false++ - name: Setup Node.js+ uses: ./.github/actions/setup-node++ # ================= Deploy Demo =================+ - name: 📦 Build demo+ run: pnpm build:demo++ - name: Copy demo to workspace+ run: |+ mkdir -p dist+ cp -r ./examples/local/* dist++ - name: 📦 Build react16 demo+ run: |+ pnpm use:react16+ pnpm build:demo++ - name: Copy react16 demo+ run: |+ mkdir -p dist/react16+ cp -r ./examples/local/* dist/react16++ # ================= Deploy Storybook =================+ - name: 📦 Build storybook+ run: pnpm storybook:build++ - name: Copy storybook+ run: |+ mkdir -p dist/storybook+ cp -r ./common/storybook/storybook-static/* dist/storybook++ # ================= Deploy to GitHub Pages =================+ - name: 🚀 Deploy to GitHub Pages+ uses: peaceiris/actions-gh-pages@v4+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ publish_dir: ./dist+ keep_files: truediff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.ymlindex 0deafb04c0..d2f2d93447 100644--- a/.github/workflows/preview-deploy.yml+++ b/.github/workflows/preview-deploy.yml@@ -12,7 +12,7 @@ concurrency:cancel-in-progress: truepermissions:- contents: read+ contents: writepull-requests: writeactions: read@@ -25,6 +25,7 @@ jobs:id: ${{ steps.pr.outputs.value }}ref: ${{ steps.ref.outputs.value }}repo: ${{ steps.repo.outputs.value }}+ state: ${{ steps.state.outputs.value }}steps:# Get PR id from artifact@@ -63,9 +64,22 @@ jobs:id: reporun: echo "value=$(<pr-repo.txt)" >> $GITHUB_OUTPUT+ # Get PR state from artifact+ - name: download pr state artifact+ uses: dawidd6/action-download-artifact@v9+ with:+ workflow: ${{ github.event.workflow_run.workflow_id }}+ run_id: ${{ github.event.workflow_run.id }}+ name: pr-state++ - name: get PR state+ id: state+ run: echo "value=$(<pr-state.txt)" >> $GITHUB_OUTPUT+prepare:runs-on: ubuntu-latestneeds: [setup]+ if: ${{ needs.setup.outputs.id != '' && needs.setup.outputs.state != 'closed' }}steps:# ================= Create Comment =================@@ -96,13 +110,10 @@ jobs:</p>edit-mode: replace- build-demo:+ build-and-deploy:runs-on: ubuntu-latestneeds: [setup]-- outputs:- preview-url: ${{ steps.vercel-demo-dev.outputs.preview-url == '' && steps.vercel-demo.outputs.preview-url || steps.vercel-demo-dev.outputs.preview-url }}- commit-message: ${{ steps.commit-message.outputs.value }}+ if: ${{ needs.setup.outputs.id != '' }}steps:- name: Checkout@@ -130,99 +141,56 @@ jobs:id: commit-messagerun: echo "value=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT+ - name: Prepare dist directory+ run: mkdir -p dist+# ================= Deploy Demo =================- name: 📦 Build demo+ if: ${{ needs.setup.outputs.state != 'closed' }}run: pnpm build:demo- name: Copy demo to workspace- run: |- mkdir .workspace- cp -r ./examples/local/* .workspace+ if: ${{ needs.setup.outputs.state != 'closed' }}+ run: cp -r ./examples/local/* dist- name: 📦 Build react16 demo+ if: ${{ needs.setup.outputs.state != 'closed' }}run: |pnpm use:react16pnpm build:demo- - name: Copy demo to workspace+ - name: Copy react16 demo+ if: ${{ needs.setup.outputs.state != 'closed' }}run: |- mkdir .workspace/react16- cp -r ./examples/local/* .workspace/react16-- - name: 🚀 Deploy to Vercel (demo)- uses: amondnet/vercel-action@v25- if: ${{ needs.setup.outputs.ref == '' }}- id: vercel-demo- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID}}- vercel-args: --prod-- - name: 🚀 Deploy to Vercel (demo)- uses: amondnet/vercel-action@v25- if: ${{ needs.setup.outputs.ref != '' }}- id: vercel-demo-dev- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID}}-- build-storybook:- runs-on: ubuntu-latest- needs: [setup]-- outputs:- preview-url: ${{ steps.vercel-storybook-dev.outputs.preview-url == '' && steps.vercel-storybook.outputs.preview-url || steps.vercel-storybook-dev.outputs.preview-url }}-- steps:- - name: Checkout- uses: actions/checkout@v4- with:- repository: ${{ needs.setup.outputs.repo }}- ref: ${{ needs.setup.outputs.ref }}- persist-credentials: false-- - name: Setup pnpm- uses: pnpm/action-setup@v4- with:- run_install: false-- - name: Setup Node.js- uses: actions/setup-node@v4- with:- node-version: 24.3.0- cache: pnpm-- - name: Install dependencies- run: pnpm install+ mkdir -p dist/react16+ cp -r ./examples/local/* dist/react16# ================= Deploy Storybook =================- name: 📦 Build storybook+ if: ${{ needs.setup.outputs.state != 'closed' }}run: pnpm storybook:build- - name: 🚀 Deploy to Vercel (demo)- uses: amondnet/vercel-action@v25- if: ${{ needs.setup.outputs.ref == '' }}- id: vercel-storybook- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK}}- vercel-args: --prod-- - name: 🚀 Deploy to Vercel (storybook)- uses: amondnet/vercel-action@v25- if: ${{ needs.setup.outputs.ref != '' }}- id: vercel-storybook-dev+ - name: Copy storybook+ if: ${{ needs.setup.outputs.state != 'closed' }}+ run: |+ mkdir -p dist/storybook+ cp -r ./common/storybook/storybook-static/* dist/storybook++ # ================= Deploy PR Preview =================+ - name: 🚀 Deploy to GitHub Pages (preview)+ uses: rossjrw/pr-preview-action@v1with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK}}+ source-dir: ./dist+ preview-branch: gh-pages+ umbrella-dir: pr-preview+ pr-number: ${{ needs.setup.outputs.id }}+ comment: false+ action: ${{ needs.setup.outputs.state == 'closed' && 'remove' || 'deploy' }}notify:runs-on: ubuntu-latest- needs: [setup, build-demo, build-storybook]+ needs: [setup, build-and-deploy]+ if: ${{ needs.setup.outputs.id != '' && needs.setup.outputs.state != 'closed' }}steps:# ================= Create Comment =================@@ -245,5 +213,5 @@ jobs:## View Deployment| 📑 Demo (React@19) | Demo (React@16) | 📚 Storybook || --- | --- | --- |- | [🔗 Preview link](${{ needs.build-demo.outputs.preview-url }}/) | [🔗 Preview link](${{ needs.build-demo.outputs.preview-url }}/react16/) | [🔗 Preview link](${{ needs.build-storybook.outputs.preview-url }}/) |+ | [🔗 Preview link](https://dream-num.github.io/univer/pr-preview/pr-${{ needs.setup.outputs.id }}/) | [🔗 Preview link](https://dream-num.github.io/univer/pr-preview/pr-${{ needs.setup.outputs.id }}/react16/) | [🔗 Preview link](https://dream-num.github.io/univer/pr-preview/pr-${{ needs.setup.outputs.id }}/storybook/) |edit-mode: replacediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 6daa5d30b3..a6899dbdb3 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -82,65 +82,3 @@ jobs:env:NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}NPM_CONFIG_PROVENANCE: true-- build-demo:- runs-on: ubuntu-latest- needs: [release-npm]-- outputs:- preview-url: ${{ steps.vercel-demo.outputs.preview-url }}-- steps:- - name: Checkout- uses: actions/checkout@v4- with:- persist-credentials: false-- - name: Setup Node.js- uses: ./.github/actions/setup-node-- # ================= Deploy Demo =================- - name: 📦 Build demo- run: pnpm build:demo-- - name: Copy demo to workspace- run: |- mkdir .workspace- cp -r ./examples/local/* .workspace-- - name: 🚀 Deploy to Vercel (demo)- uses: amondnet/vercel-action@v25- id: vercel-demo- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID }}-- build-storybook:- runs-on: ubuntu-latest- needs: [release-npm]-- outputs:- preview-url: ${{ steps.vercel-storybook.outputs.preview-url }}-- steps:- - name: Checkout- uses: actions/checkout@v4- with:- persist-credentials: false-- - name: Setup Node.js- uses: ./.github/actions/setup-node-- # ================= Deploy Storybook =================- - name: 📦 Build storybook- run: pnpm storybook:build-- - name: 🚀 Deploy to Vercel (storybook)- uses: amondnet/vercel-action@v25- id: vercel-storybook- with:- vercel-token: ${{ secrets.VERCEL_TOKEN }}- vercel-org-id: ${{ secrets.ORG_ID }}- vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK }}- vercel-args: --proddiff --git a/.github/workflows/setup.yml b/.github/workflows/setup.ymlindex b506f4f9fb..70a61128ae 100644--- a/.github/workflows/setup.yml+++ b/.github/workflows/setup.yml@@ -5,6 +5,7 @@ on:branches: [dev]pull_request:branches: [dev]+ types: [opened, synchronize, reopened, closed]permissions:actions: write@@ -24,10 +25,12 @@ jobs:PR_ID: ${{ github.event.pull_request.number || '' }}PR_REF: ${{ github.head_ref || github.ref_name }}PR_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}+ PR_STATE: ${{ github.event.pull_request.state || '' }}run: |printf '%s\n' "$PR_ID" > ./pr-id.txtprintf '%s\n' "$PR_REF" > ./pr-ref.txtprintf '%s\n' "$PR_REPO" > ./pr-repo.txt+ printf '%s\n' "$PR_STATE" > ./pr-state.txt- name: Upload PR numberuses: actions/upload-artifact@v4@@ -46,3 +49,9 @@ jobs:with:name: pr-repopath: ./pr-repo.txt++ - name: Upload PR state+ uses: actions/upload-artifact@v4+ with:+ name: pr-state+ path: ./pr-state.txt