From b262e82b5511348c02e146868f42b53aab0bf007 Mon Sep 17 00:00:00 2001 From: xpcool Date: Sat, 22 Aug 2026 14:18:25 +0800 Subject: [PATCH 1/5] ci: add gitea actions deploy workflow --- .gitea/workflows/deploy.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..e221d53 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -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" From 475610e941f344de78b35d6fff782d2d0fb45da6 Mon Sep 17 00:00:00 2001 From: xpcool Date: Sat, 22 Aug 2026 14:21:56 +0800 Subject: [PATCH 2/5] ci: trigger deploy run --- .ci-trigger | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ci-trigger diff --git a/.ci-trigger b/.ci-trigger new file mode 100644 index 0000000..6a15ec6 --- /dev/null +++ b/.ci-trigger @@ -0,0 +1 @@ +ci trigger 20260822T062156Z \ No newline at end of file From b89b6a1ebea4f2df9cf2117ae3650377ab8c7685 Mon Sep 17 00:00:00 2001 From: xpcool Date: Sat, 22 Aug 2026 14:30:32 +0800 Subject: [PATCH 3/5] ci: local checkout (no external actions) --- .gitea/workflows/deploy.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index e221d53..38f6af1 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,3 +1,4 @@ +# deployed by gitea act_runner (push to main/dev triggers this) name: Build and Deploy (tool.xpcool.com) on: @@ -9,13 +10,22 @@ 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: Install git + run: | + apt-get update + apt-get install -y git - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout (local Gitea, no external actions) + run: | + git clone --depth 1 https://oauth2:${{ github.token }}@git.xpcool.com/${{ github.repository }}.git . + git checkout ${{ github.sha }} + + - name: Use npmmirror registry (faster in CN) + run: npm config set registry https://registry.npmmirror.com - name: Enable pnpm via corepack + env: + COREPACK_NPM_REGISTRY: https://registry.npmmirror.com run: | corepack enable corepack prepare pnpm@10 --activate From 2fd700fb1694fda2a9f79761adadfa185dd0f460 Mon Sep 17 00:00:00 2001 From: xpcool Date: Sat, 22 Aug 2026 14:41:37 +0800 Subject: [PATCH 4/5] ci: use Tencent apt mirror --- .gitea/workflows/deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 38f6af1..86f6956 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -10,8 +10,10 @@ jobs: build-and-deploy: runs-on: ubuntu-latest steps: - - name: Install git + - name: Install git (Tencent mirror apt) run: | + sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g; s|security.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list 2>/dev/null || true + sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g; s|security.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || true apt-get update apt-get install -y git From 833720b7bfc2f42eb07ebee96a818b9f7f62682e Mon Sep 17 00:00:00 2001 From: xpcool Date: Sat, 22 Aug 2026 14:47:54 +0800 Subject: [PATCH 5/5] ci: checkout with --branch ref_name --- .gitea/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 86f6956..680b5e3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout (local Gitea, no external actions) run: | - git clone --depth 1 https://oauth2:${{ github.token }}@git.xpcool.com/${{ github.repository }}.git . + git clone --depth 1 --branch "${{ github.ref_name }}" https://oauth2:${{ github.token }}@git.xpcool.com/${{ github.repository }}.git . git checkout ${{ github.sha }} - name: Use npmmirror registry (faster in CN)