55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: Deploy Navigation Site
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm init -y
|
|
npm install js-yaml
|
|
|
|
- name: Generate site
|
|
run: node generator.js
|
|
|
|
- name: Prepare deployment
|
|
run: |
|
|
# 确保目录存在
|
|
mkdir -p dist
|
|
|
|
# 复制网站文件
|
|
cp index.html dist/
|
|
cp style.css dist/
|
|
cp script.js dist/
|
|
|
|
# 显示文件列表以验证
|
|
echo "Deployment files:"
|
|
ls -la dist/
|
|
|
|
# 检查文件内容
|
|
echo "Checking index.html..."
|
|
head -n 10 dist/index.html
|
|
|
|
- name: Deploy to GitHub Pages
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
|
with:
|
|
folder: dist
|
|
branch: gh-pages
|
|
clean: true |