-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (49 loc) · 1.57 KB
/
deploy.yml
File metadata and controls
62 lines (49 loc) · 1.57 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
name: Build and Deploy to GitHub Pages
on:
push:
branches:
- main # Deploy when pushing to new-website branch
workflow_dispatch: # Allow manual triggering from GitHub UI
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write # Required for pushing to the repository
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper git operations
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build static site
run: npm run build
- name: Prepare GitHub Pages deployment
run: |
# Remove existing docs directory if it exists
rm -rf docs
# Copy build output to docs directory
cp -r build docs
# Create .nojekyll file to bypass Jekyll processing
touch docs/.nojekyll
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit and push changes
run: |
git add docs
# Only commit if there are changes
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "update github pages"
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}