From e8725713b63043b89e65be05e81cee03b20a3987 Mon Sep 17 00:00:00 2001 From: Shua Date: Sun, 29 Dec 2024 14:43:57 +0800 Subject: [PATCH] Create deploy.yml --- .github/workflows/deploy.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8d0e460 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main # 监听 main 分支的推送事件 + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + # 检出代码 + - name: Checkout code + uses: actions/checkout@v3 + + # 设置 Node.js 环境 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + # 安装依赖 + - name: Install dependencies + run: npm install + + # 构建项目 + - name: Build project + run: npm run build + + # 部署到 GitHub Pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build