-
Notifications
You must be signed in to change notification settings - Fork 29
64 lines (55 loc) · 1.45 KB
/
publish.yaml
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
name: Publish to Cloudflare
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
paths:
- ".github/workflows/publish.yaml"
- ".vitepress/**"
- "src/**"
- "theme/**"
- "package-lock.json"
- "package.json"
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: "publish"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: current
- name: Install
run: pnpm install
- name: Build
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |
sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md
pnpm run web:build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
projectName: transky-book
directory: .vitepress/dist/
wranglerVersion: 3