-
Notifications
You must be signed in to change notification settings - Fork 154
107 lines (84 loc) · 2.38 KB
/
update-deploy.yml
File metadata and controls
107 lines (84 loc) · 2.38 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
name: 更新数据并部署
on:
schedule:
- cron: '0 */3 * * *'
push:
branches: [main, dev]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "deploy"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: pnpm/action-setup@v3
with:
version: 8.4.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update RSS feeds
run: node scripts/update-feeds.js
env:
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_API_BASE: ${{ secrets.LLM_API_BASE }}
LLM_NAME: ${{ secrets.LLM_NAME }}
- name: Build static site
run: pnpm build
- name: Copy vercel config to output
run: cp vercel.json ./out/
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: site-build
path: ./out
retention-days: 1
deploy-github-pages:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: site-build
path: ./out
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: ./out
- id: deployment
uses: actions/deploy-pages@v4
deploy-branch:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: site-build
path: ./build-output
- name: Deploy to deploy branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Always create a fresh orphan branch (no history)
git checkout --orphan deploy-new
# Remove all existing files
git rm -rf . 2>/dev/null || true
# Copy build output
cp -r build-output/* .
rm -rf build-output
# Add and commit
git add -A
git commit -m "Deploy: $(date +'%Y-%m-%d %H:%M:%S')"
# Force push to deploy branch (replaces all history)
git push -f origin deploy-new:deploy