mirror of
https://github.com/dream-num/univer.git
synced 2026-08-30 17:21:11 +08:00
ci: remove useless workflows
This commit is contained in:
@@ -1,119 +0,0 @@
|
||||
name: 🌐 Deploy to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
- 'v*.*.*-alpha.*'
|
||||
- 'v*.*.*-beta.*'
|
||||
- 'v*.*.*-rc.*'
|
||||
|
||||
concurrency:
|
||||
group: github-pages
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.repository == 'dream-num/univer'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
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
|
||||
|
||||
- name: Checkout existing Pages branch
|
||||
uses: actions/checkout@v7
|
||||
continue-on-error: true
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: gh-pages-current
|
||||
persist-credentials: false
|
||||
|
||||
- name: Preserve recent PR previews
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if [ ! -d gh-pages-current/pr-preview ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p dist/pr-preview
|
||||
cutoff_epoch=$(date -u -d '30 days ago' +%s)
|
||||
shopt -s nullglob
|
||||
|
||||
for preview_dir in gh-pages-current/pr-preview/pr-*; do
|
||||
pr_number="${preview_dir##*/pr-}"
|
||||
if [[ ! "$pr_number" =~ ^[0-9]+$ ]]; then
|
||||
echo "Prune unexpected preview directory: ${preview_dir}"
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! pr_info=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${pr_number}" --jq '[.state, (.closed_at // "")] | @tsv' 2>/dev/null); then
|
||||
echo "Prune preview for missing PR #${pr_number}"
|
||||
continue
|
||||
fi
|
||||
|
||||
IFS=$'\t' read -r state closed_at <<< "$pr_info"
|
||||
if [ "$state" = "open" ]; then
|
||||
echo "Keep preview for open PR #${pr_number}"
|
||||
cp -a "$preview_dir" "dist/pr-preview/"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$closed_at" ]; then
|
||||
closed_epoch=$(date -u -d "$closed_at" +%s)
|
||||
if [ "$closed_epoch" -ge "$cutoff_epoch" ]; then
|
||||
echo "Keep preview for recently closed PR #${pr_number}"
|
||||
cp -a "$preview_dir" "dist/pr-preview/"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Prune preview for PR #${pr_number}"
|
||||
done
|
||||
|
||||
# ================= Deploy to GitHub Pages =================
|
||||
- name: 🚀 Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
@@ -1,222 +0,0 @@
|
||||
name: 📤 Preview Deploy
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- 🎬 Setup
|
||||
types:
|
||||
- completed
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
actions: read
|
||||
|
||||
env:
|
||||
TURBO_TELEMETRY_DISABLED: '1'
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: ${{ github.repository == 'dream-num/univer' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.full_name == github.repository }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
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
|
||||
- name: download pr artifact
|
||||
uses: dawidd6/action-download-artifact@v21
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: pr-id
|
||||
|
||||
- name: get PR id
|
||||
id: pr
|
||||
run: echo "value=$(<pr-id.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get PR ref from artifact
|
||||
- name: download pr artifact
|
||||
uses: dawidd6/action-download-artifact@v21
|
||||
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 "value=$(<pr-ref.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get PR repo from artifact
|
||||
- name: download pr artifact
|
||||
uses: dawidd6/action-download-artifact@v21
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: pr-repo
|
||||
|
||||
- name: get PR repo
|
||||
id: repo
|
||||
run: echo "value=$(<pr-repo.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get PR state from artifact
|
||||
- name: download pr state artifact
|
||||
uses: dawidd6/action-download-artifact@v21
|
||||
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-latest
|
||||
needs: [setup]
|
||||
if: ${{ github.repository == 'dream-num/univer' && needs.setup.outputs.id != '' && needs.setup.outputs.state != 'closed' }}
|
||||
|
||||
steps:
|
||||
# ================= Create Comment =================
|
||||
- name: 🧽 Find And Delete Comment
|
||||
uses: peter-evans/find-comment@v4
|
||||
if: ${{ needs.setup.outputs.id != '' }}
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ needs.setup.outputs.id }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: View Deployment
|
||||
|
||||
- name: 📝 Create or update comment
|
||||
uses: peter-evans/create-or-update-comment@v5
|
||||
if: ${{ needs.setup.outputs.id != '' }}
|
||||
with:
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
issue-number: ${{ needs.setup.outputs.id }}
|
||||
body: |
|
||||
## View Deployment
|
||||
|
||||
```txt
|
||||
status : provisioning preview
|
||||
target : pr-${{ needs.setup.outputs.id }}
|
||||
ref : ${{ needs.setup.outputs.ref }}
|
||||
run : #${{ github.run_id }}
|
||||
```
|
||||
|
||||
Preview assets are building. This comment will update with deployment links when the preview is ready.
|
||||
|
||||
[Open workflow run](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }})
|
||||
edit-mode: replace
|
||||
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [setup]
|
||||
if: ${{ github.repository == 'dream-num/univer' && needs.setup.outputs.id != '' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: ${{ needs.setup.outputs.repo }}
|
||||
ref: ${{ needs.setup.outputs.ref }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.3.0
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Get commit message
|
||||
id: commit-message
|
||||
run: 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
|
||||
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:react16
|
||||
pnpm build:demo
|
||||
|
||||
- name: Copy react16 demo
|
||||
if: ${{ needs.setup.outputs.state != 'closed' }}
|
||||
run: |
|
||||
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: 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)
|
||||
id: preview_deploy
|
||||
uses: rossjrw/pr-preview-action@v1
|
||||
with:
|
||||
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' }}
|
||||
|
||||
- name: 🧽 Find deployment comment
|
||||
uses: peter-evans/find-comment@v4
|
||||
if: ${{ needs.setup.outputs.state != 'closed' && steps.preview_deploy.outputs['deployment-action'] == 'deploy' }}
|
||||
id: preview-comment
|
||||
with:
|
||||
issue-number: ${{ needs.setup.outputs.id }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: View Deployment
|
||||
|
||||
- name: 📝 Update deployment comment
|
||||
uses: peter-evans/create-or-update-comment@v5
|
||||
if: ${{ needs.setup.outputs.state != 'closed' && steps.preview_deploy.outputs['deployment-action'] == 'deploy' }}
|
||||
with:
|
||||
comment-id: ${{ steps.preview-comment.outputs.comment-id }}
|
||||
issue-number: ${{ needs.setup.outputs.id }}
|
||||
body: |
|
||||
## View Deployment
|
||||
|
||||
[Preview](${{ steps.preview_deploy.outputs['preview-url'] }}) · [#${{ github.run_id }}](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }})
|
||||
|
||||
| Entry | Link |
|
||||
| --- | --- |
|
||||
| Demo | ${{ steps.preview_deploy.outputs['preview-url'] }} |
|
||||
| React 16 Demo | ${{ steps.preview_deploy.outputs['preview-url'] }}react16/ |
|
||||
| Storybook | ${{ steps.preview_deploy.outputs['preview-url'] }}storybook/ |
|
||||
edit-mode: replace
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
jobs:
|
||||
dispatch-sync:
|
||||
if: github.repository == 'dream-num/univer'
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: minimum-runner
|
||||
|
||||
steps:
|
||||
- name: Dispatch sync event to univer-pro
|
||||
|
||||
@@ -4,16 +4,6 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
@@ -27,7 +17,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
semgrep:
|
||||
if: github.repository == 'dream-num/univer' && (github.event_name != 'pull_request' || !github.event.pull_request.draft)
|
||||
if: github.repository == 'dream-num/univer'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
|
||||
@@ -104,7 +94,7 @@ jobs:
|
||||
|
||||
- name: Upload Semgrep SARIF to GitHub
|
||||
id: upload-sarif
|
||||
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
|
||||
if: ${{ always() }}
|
||||
continue-on-error: true
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user