feat: Add GitHub Actions workflow for deploying to GitHub Pages and include CNAME file

This commit is contained in:
sHa
2025-04-27 22:01:33 +03:00
parent 5e17d20364
commit db01614dd8
2 changed files with 38 additions and 0 deletions

37
.github/workflows/gh-pages.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Copy CNAME (if exists)
run: |
if [ -f public/CNAME ]; then
cp public/CNAME public/build/CNAME
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public/build
publish_branch: gh-pages