generated from kaiyuanshe/China-Open-Source-Report-Template
-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (81 loc) · 3.14 KB
/
deploy.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
82
83
84
85
86
87
88
89
90
name: Deploy to GitHub Pages & Gitee Page & Vercel
on:
push:
branches:
- main
# 如果你想要进一步定义触发条件、路径等,可以查看文档
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
deploy:
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
LARK_CHATBOT_HOOK_URL: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Vercel
id: vercel-deployment
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./
vercel-args: --prod
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm i
- name: Build website for GitHub
run: pnpm build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
# 要发布到 `gh-pages` 分支的构建输出:
publish_dir: ./.vitepress/dist
force_orphan: true
- name: Build website for gitee
run: VITE_DEPLOYMENT_ENVIRONMENT=gitee pnpm build
- name: Deploy to Gitee Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gitee # default: gh-pages
publish_dir: ./.vitepress/dist
force_orphan: true
- name: Lark notification
uses: foxundermoon/feishu-action@v2
if: ${{ env.LARK_CHATBOT_HOOK_URL }}
with:
url: ${{ secrets.LARK_CHATBOT_HOOK_URL }}
msg_type: post
content: |
post:
zh_cn:
title: Vercel 预览环境
content:
- - tag: text
text: Git 仓库:
- tag: a
text: ${{ github.server_url }}/${{ github.repository }}
href: ${{ github.server_url }}/${{ github.repository }}
- - tag: text
text: 代码分支:
- tag: a
text: ${{ github.ref }}
href: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
- - tag: text
text: 预览链接:
- tag: a
text: ${{ steps.vercel-deployment.outputs.preview-url }}
href: ${{ steps.vercel-deployment.outputs.preview-url }}