Skip to content

Commit 1469283

Browse files
committed
ci: 优化 GitHub Actions 部署配置
1 parent 4383f0b commit 1469283

5 files changed

Lines changed: 8331 additions & 48 deletions

File tree

.actrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-P ubuntu-latest=node:24-bookworm

.github/workflows/ci.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy static content to Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
# 优化:收紧了 contents 权限
13+
permissions:
14+
contents: read
15+
id-token: write
16+
pages: write
17+
18+
jobs:
19+
docs:
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "24"
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Build site
38+
run: npm run build
39+
40+
- name: Update Algolia Index
41+
if: github.actor != 'nektos/act'
42+
env:
43+
HEXO_ALGOLIA_INDEXING_KEY: ${{ secrets.HEXO_ALGOLIA_INDEXING_KEY }}
44+
run: npm run algolia
45+
46+
- name: Upload GitHub Pages artifact
47+
if: github.actor != 'nektos/act'
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: ./public
51+
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
if: github.ref == 'refs/heads/master' && github.actor != 'nektos/act'
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ node_modules/
66
public/
77
.deploy*/
88
_multiconfig.yml
9-
package-lock.json
109
yarn.lock

0 commit comments

Comments
 (0)