From 451e73cccfc38b260ecf5456795bc1d122db9493 Mon Sep 17 00:00:00 2001 From: chilingling <26962197+chilingling@users.noreply.github.com> Date: Mon, 15 Sep 2025 12:44:34 +0800 Subject: [PATCH] ci: deploy to gh pages (#1629) --- .github/workflows/deploy-gh-pages.yml | 50 +++++++++++++++++++++++++++ designer-demo/registry.js | 7 ++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/deploy-gh-pages.yml diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 000000000..6b565cb21 --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,50 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: [develop] + +jobs: + deploy-gh-pages: + runs-on: ubuntu-latest + concurrency: + group: deploy-gh-pages + cancel-in-progress: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: pnpm install + + - name: add environment variable + run: | + cat <<'EOF' >> designer-demo/env/.env.alpha + // ---- appended by CI (gh-pages) ---- + VITE_ORIGIN=https://agent.opentiny.design/ + EOF + + - name: Run Build + run: pnpm run build:plugin && pnpm run build:alpha > /tmp/build-alpha.log 2>&1 + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./designer-demo/dist/ + keep_files: true + force_orphan: false + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/designer-demo/registry.js b/designer-demo/registry.js index 23d7d0c82..c9101279d 100644 --- a/designer-demo/registry.js +++ b/designer-demo/registry.js @@ -43,5 +43,12 @@ export default { } } } + }, + [META_APP.Preview]: { + options: { + // 配置预览跳转的 url: + // 文档:https://opentiny.design/tiny-engine#/help-center/course/dev/preview-api + previewUrl: ['prod', 'alpha'].includes(import.meta.env.MODE) ? './preview.html' : '' + } } }