ci: add gitea actions deploy workflow

This commit is contained in:
xpcool 2026-08-22 14:18:25 +08:00
parent ea2737f589
commit b262e82b55

View File

@ -0,0 +1,42 @@
name: Build and Deploy (tool.xpcool.com)
on:
push:
branches: [main, dev]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Install git (node image has no git)
run: apt-get update && apt-get install -y git
- name: Checkout
uses: actions/checkout@v4
- name: Enable pnpm via corepack
run: |
corepack enable
corepack prepare pnpm@10 --activate
- name: Install dependencies
run: pnpm install
- name: Build (Vite)
run: pnpm build
- name: Deploy to /data/www/tool.xpcool.com
run: |
set -e
SRC=dist
DST=/data/www/tool.xpcool.com
if [ ! -d "$SRC" ]; then
echo "BUILD OUTPUT NOT FOUND: $SRC"
exit 1
fi
mkdir -p "$DST"
find "$DST" -mindepth 1 -delete
cp -r "$SRC"/. "$DST"/
chmod -R a+rX "$DST"
echo "Deployed tool.xpcool.com -> $DST"