-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.11 KB
/
Copy pathdeploy-pages.yaml
File metadata and controls
50 lines (40 loc) · 1.11 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
name: Deploy Pages
on:
push:
branches: [main]
paths:
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deploy docs to gh-pages branch
run: |
git config user.name "relentlessworks[bot]"
git config user.email "noreply@relentlessworks.com"
# Save docs to temp
cp -r docs /tmp/docs
# Check if gh-pages branch exists
if git rev-parse --verify origin/gh-pages >/dev/null 2>&1; then
git checkout gh-pages
else
git checkout --orphan gh-pages
fi
# Clean working tree
git rm -rf . 2>/dev/null || true
# Copy docs content
cp -r /tmp/docs/* .
# Commit and push
git add -A
git commit -m "Deploy docs from ${{ github.sha }}" || echo "No changes to commit"
git push origin gh-pages --force