From 230e9d713c42e8e042f77dd1e4344be73b02d017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E9=A3=8E?= Date: Tue, 10 Mar 2026 17:57:42 +0800 Subject: [PATCH] add CD --- .gitea/workflows/build.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..00e47e3 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build Hexo Site + +on: + push: + branches: [main, master] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Cache npm dependencies + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm install + + - name: Build Hexo + run: npm run build + + - name: Deploy to local directory + run: | + rm -rf /home/ubuntu/html/* + cp -r public/* /home/ubuntu/html/ + echo "✅ Hexo 构建完成,已输出到 /home/ubuntu/html" \ No newline at end of file