-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (119 loc) · 5.12 KB
/
deploy.yml
File metadata and controls
137 lines (119 loc) · 5.12 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Deploy to GitHub Pages
on:
push:
branches:
- master
jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Record job start time
run: echo "JOB_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
# - name: Notify Lark (started)
# continue-on-error: true
# env:
# LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
# LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
# JOB_NAME: Build Docusaurus
# COMMIT_SHORT_SHA: ${{ github.sha }}
# COMMIT_AUTHOR: ${{ github.actor }}
# JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" \
# sh .github/scripts/notify-lark.sh started
- uses: actions/setup-node@v4
with:
node-version: 21.7.3
cache: npm
cache-dependency-path: www/package-lock.json
- name: Install dependencies
run: cd www && npm ci
- name: Build website
run: cd www && npm run build
- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: www/build
- name: Notify Lark (success)
if: success()
continue-on-error: true
env:
LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
JOB_NAME: Build Docusaurus
COMMIT_SHORT_SHA: ${{ github.sha }}
COMMIT_AUTHOR: ${{ github.actor }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" sh .github/scripts/notify-lark.sh success
- name: Notify Lark (failure)
if: failure()
continue-on-error: true
env:
LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
JOB_NAME: Build Docusaurus
COMMIT_SHORT_SHA: ${{ github.sha }}
COMMIT_AUTHOR: ${{ github.actor }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
JOB_STARTED_AT="${JOB_STARTED_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" sh .github/scripts/notify-lark.sh failed
deploy:
name: Deploy to GitHub Pages
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Record job start time
run: echo "JOB_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
# - name: Notify Lark (started)
# continue-on-error: true
# env:
# LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
# LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
# JOB_NAME: Deploy to GitHub Pages
# COMMIT_SHORT_SHA: ${{ github.sha }}
# COMMIT_AUTHOR: ${{ github.actor }}
# JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" \
# sh .github/scripts/notify-lark.sh started
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Notify Lark (success)
if: success()
continue-on-error: true
env:
LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
JOB_NAME: Deploy to GitHub Pages
COMMIT_SHORT_SHA: ${{ github.sha }}
COMMIT_AUTHOR: ${{ github.actor }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" sh .github/scripts/notify-lark.sh success
- name: Notify Lark (failure)
if: failure()
continue-on-error: true
env:
LARK_DEPLOY_WEBHOOK_URL: ${{ secrets.LARK_DEPLOY_WEBHOOK_URL }}
LARK_DEPLOY_WEBHOOK_SECRET: ${{ secrets.LARK_DEPLOY_WEBHOOK_SECRET }}
JOB_NAME: Deploy to GitHub Pages
COMMIT_SHORT_SHA: ${{ github.sha }}
COMMIT_AUTHOR: ${{ github.actor }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
JOB_STARTED_AT="${JOB_STARTED_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
COMMIT_SHORT_SHA="${COMMIT_SHORT_SHA:0:8}" sh .github/scripts/notify-lark.sh failed