Repository navigation
54 lines (50 loc) · 1.53 KB
/
Copy pathdeploy.yml
File metadata and controls
54 lines (50 loc) · 1.53 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
name: Build and publish gh-pages
on:
push:
branches: ['main']
workflow_dispatch:
permissions:
contents: write
concurrency:
group: gh-pages-publish
cancel-in-progress: true
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.16.0'
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- name: Install dependencies
working-directory: website
run: pnpm install --frozen-lockfile
- name: Build site
working-directory: website
run: pnpm run build
- name: Prepare static branch
run: |
touch website/dist/.nojekyll
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages || true
git worktree add --detach /tmp/gh-pages origin/gh-pages
find /tmp/gh-pages -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
cp -R website/dist/. /tmp/gh-pages/
cd /tmp/gh-pages
git add -A
if git diff --cached --quiet; then
echo "No deployment changes."
else
git commit -m "deploy: ${GITHUB_SHA}"
git push origin HEAD:gh-pages
fi