-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.23 KB
/
Copy pathdeploy-to-docs.yml
File metadata and controls
51 lines (43 loc) · 1.23 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
name: Deploy Built Site to docs/
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- name: Build site
run: npm run build
env:
# Use a relative base so assets in `dist` are referenced relatively.
# This makes `docs/` deployments work regardless of Pages repo/site configuration.
VITE_BASE: ./
- name: Commit dist to docs/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
rm -rf docs || true
mkdir docs
cp -R dist/* docs/
git add docs
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: deploy site to docs [ci skip]"
git push origin HEAD:main
fi