-
Notifications
You must be signed in to change notification settings - Fork 8
81 lines (75 loc) · 2.47 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Preview Home Page
on:
workflow_dispatch:
pull_request_target:
paths:
- "projects/fastgpt/**"
branches:
- "new-home"
- "main"
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
permissions:
actions: read # Only required for private GitHub Repo
contents: read
deployments: write
pull-requests: write
runs-on: ubuntu-latest
# Job outputs
outputs:
url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: recursive # Fetch submodules
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
- name: Build
env:
NEXT_PUBLIC_HOME_URL: https://tryfastgpt.ai
NEXT_PUBLIC_USER_URL: https://cloud.tryfastgpt.ai
run: |
cd projects/fastgpt
npm install
npm run build
- name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ./projects/fastgpt/out --project-name=fastgpt-home-run
docsOutput:
needs: [ deploy ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Write md
run: |
echo "# 📘 Preview FastGPT homepage" > report.md
echo "[👀 Visit Preview](${{ needs.deploy.outputs.url }})" >> report.md
cat report.md
- name: Print preview url
uses: labring/[email protected]
if: ${{ (github.event_name == 'pull_request_target') }}
with:
version: v0.0.6
env:
GH_TOKEN: "${{ secrets.GH_PAT }}"
SEALOS_TYPE: "pr_comment"
SEALOS_FILENAME: "report.md"
SEALOS_REPLACE_TAG: "DEFAULT_REPLACE_DEPLOY"