From 00a0613f1356e7657a68230c0802be1ec2a881df Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 15:03:59 +0800 Subject: [PATCH 01/18] =?UTF-8?q?ci:=20=E6=96=B0=E5=BB=BAworkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 测试构建工作流 --- .gitea/workflows/deploy.yml | 13 +++++++++++++ 1 file changed, 13 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..508f95c --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,13 @@ +name: deploy to server + +on: + push: + branches: + - ci/gitea-actions + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pnpm install && pnpm build -- 2.49.0 From ec0608cc7c24e1e5f37dc438c050eee0461c62d3 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 15:13:39 +0800 Subject: [PATCH 02/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为workflow添加pnpm包管理器 - 调整workflow steps命名 --- .gitea/workflows/deploy.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 508f95c..95d9a69 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -3,11 +3,22 @@ name: deploy to server on: push: branches: - - ci/gitea-actions + - '*' jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - run: pnpm install && pnpm build + - name: Checkout + uses: actions/checkout@v5 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + - name: Setup node 22 + uses: actions/setup-node@v5 + with: + node-version: '22' + cache: 'pnpm' + - name: Install dependencies + run: pnpm install + - name: Build project + run: pnpm run build -- 2.49.0 From 3366b46039dda62c05a74a7dabe4073211554eff Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 15:18:30 +0800 Subject: [PATCH 03/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将workflow的启用分支改为所有分支 --- .gitea/workflows/deploy.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 95d9a69..1116854 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,9 +1,6 @@ name: deploy to server -on: - push: - branches: - - '*' +on: push jobs: build: -- 2.49.0 From f12c8c050aff70b81a5a651a5068b1dfcbf0320a Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 15:39:03 +0800 Subject: [PATCH 04/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 指定pnpm版本为10 --- .gitea/workflows/deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 1116854..695e810 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -10,6 +10,8 @@ jobs: uses: actions/checkout@v5 - name: Setup pnpm uses: pnpm/action-setup@v4 + with: + version: 10 - name: Setup node 22 uses: actions/setup-node@v5 with: -- 2.49.0 From d154fed609ee18273eac752c84ead3121c7502ab Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 16:13:21 +0800 Subject: [PATCH 05/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加构建产物的上传/下载 --- .gitea/workflows/deploy.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 695e810..3cfbfe6 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -21,3 +21,20 @@ jobs: run: pnpm install - name: Build project run: pnpm run build + - name: Upload build output + uses: actions/upload-artifact@v4 + with: + name: nuxt-output + path: .output + + deploy: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Download build output + uses: actions/download-artifact@v4 + with: + name: nuxt-output + path: .output -- 2.49.0 From e54d5ef3c2b3125643d7a112a1692704267d89fc Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 16:15:12 +0800 Subject: [PATCH 06/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为deploy添加build的前置要求 --- .gitea/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3cfbfe6..e4530b3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -29,6 +29,7 @@ jobs: deploy: runs-on: ubuntu-latest + needs: build if: github.ref == 'refs/heads/master' steps: - name: Checkout -- 2.49.0 From 7f28f7bf810ee3ff8605f02093909a19c01cf971 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 16:25:04 +0800 Subject: [PATCH 07/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改缩进格式 --- .gitea/workflows/deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index e4530b3..145cd2c 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -36,6 +36,6 @@ jobs: uses: actions/checkout@v5 - name: Download build output uses: actions/download-artifact@v4 - with: - name: nuxt-output - path: .output + with: + name: nuxt-output + path: .output -- 2.49.0 From cbbae112dc309c04bf350ef5f032403a52379605 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 16:38:59 +0800 Subject: [PATCH 08/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 启用缓存服务 --- .gitea/workflows/deploy.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 145cd2c..0ad2e5b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -17,6 +17,22 @@ jobs: with: node-version: '22' cache: 'pnpm' + - name: Cache pnpm store + uses: actions/cache@v4 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + # Nuxt 构建缓存,加快二次构建 + - name: Cache Nuxt build + uses: actions/cache@v4 + with: + path: .nuxt + key: ${{ runner.os }}-nuxt-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-nuxt- + - name: Install dependencies run: pnpm install - name: Build project -- 2.49.0 From 73620f07776f47afbcc89c28588adcb1da7557dc Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 17:00:13 +0800 Subject: [PATCH 09/18] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为其他分支启用deploy进行测试 --- .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 0ad2e5b..cf98a52 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -46,7 +46,7 @@ jobs: deploy: runs-on: ubuntu-latest needs: build - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' steps: - name: Checkout uses: actions/checkout@v5 @@ -55,3 +55,5 @@ jobs: with: name: nuxt-output path: .output + - name: Rsync build artifact to server + run: rsync -avz --delete .output/ remilia@192.168.86.5:/home/remilia/Jinshenwebsite/front-build -- 2.49.0 From 723c0cbb3a92e7f2f4745abd488b59161e2b1a76 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 17:08:01 +0800 Subject: [PATCH 10/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 合并build与deploy --- .gitea/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index cf98a52..e71e935 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -41,7 +41,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: nuxt-output - path: .output + path: .output/ deploy: runs-on: ubuntu-latest @@ -54,6 +54,6 @@ jobs: uses: actions/download-artifact@v4 with: name: nuxt-output - path: .output + path: .output/ - name: Rsync build artifact to server run: rsync -avz --delete .output/ remilia@192.168.86.5:/home/remilia/Jinshenwebsite/front-build -- 2.49.0 From ad66ae1b46269724335de3ab73c7bdc471376353 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 17:12:08 +0800 Subject: [PATCH 11/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改.nuxt缓存位置 --- .gitea/workflows/deploy.yml | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index e71e935..4407899 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -3,7 +3,7 @@ name: deploy to server on: push jobs: - build: + build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout @@ -24,6 +24,8 @@ jobs: key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- + - name: Install dependencies + run: pnpm install # Nuxt 构建缓存,加快二次构建 - name: Cache Nuxt build uses: actions/cache@v4 @@ -32,28 +34,7 @@ jobs: key: ${{ runner.os }}-nuxt-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-nuxt- - - - name: Install dependencies - run: pnpm install - name: Build project run: pnpm run build - - name: Upload build output - uses: actions/upload-artifact@v4 - with: - name: nuxt-output - path: .output/ - - deploy: - runs-on: ubuntu-latest - needs: build - # if: github.ref == 'refs/heads/master' - steps: - - name: Checkout - uses: actions/checkout@v5 - - name: Download build output - uses: actions/download-artifact@v4 - with: - name: nuxt-output - path: .output/ - name: Rsync build artifact to server run: rsync -avz --delete .output/ remilia@192.168.86.5:/home/remilia/Jinshenwebsite/front-build -- 2.49.0 From db49e7411012d2aec7f67b2dd68a340ac46a8473 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 17:23:21 +0800 Subject: [PATCH 12/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用action进行rsync --- .gitea/workflows/deploy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4407899..0f882cc 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -37,4 +37,10 @@ jobs: - name: Build project run: pnpm run build - name: Rsync build artifact to server - run: rsync -avz --delete .output/ remilia@192.168.86.5:/home/remilia/Jinshenwebsite/front-build + uses: tempersama/rsync-action@2.3 + with: + host: {{ secrets.rsync_host }} + username: {{ secrets.rsync_username }} + source: {{ secrets.rsync_source }} + destination: {{ secrets.rsync_destination }} + key: {{ secrets.rsync_key }} -- 2.49.0 From 39bede38d3029e80de54e5bdfd4dd6b5cca907e9 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 24 Sep 2025 17:25:33 +0800 Subject: [PATCH 13/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正语法错误 --- .gitea/workflows/deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 0f882cc..f22e282 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -39,8 +39,8 @@ jobs: - name: Rsync build artifact to server uses: tempersama/rsync-action@2.3 with: - host: {{ secrets.rsync_host }} - username: {{ secrets.rsync_username }} - source: {{ secrets.rsync_source }} - destination: {{ secrets.rsync_destination }} - key: {{ secrets.rsync_key }} + host: ${{ secrets.rsync_host }} + username: ${{ secrets.rsync_username }} + source: ${{ secrets.rsync_source }} + destination: ${{ secrets.rsync_destination }} + key: ${{ secrets.rsync_key }} -- 2.49.0 From 64b5f761d5cb031311e687deabd353caa87d34c0 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 25 Sep 2025 10:46:17 +0800 Subject: [PATCH 14/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改部署所使用的action --- .gitea/workflows/deploy.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index f22e282..b80ceac 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -37,10 +37,11 @@ jobs: - name: Build project run: pnpm run build - name: Rsync build artifact to server - uses: tempersama/rsync-action@2.3 + uses: easingthemes/ssh-deploy@main with: - host: ${{ secrets.rsync_host }} - username: ${{ secrets.rsync_username }} - source: ${{ secrets.rsync_source }} - destination: ${{ secrets.rsync_destination }} - key: ${{ secrets.rsync_key }} + ARGS: "-rlgoDzvc -i --delete" + REMOTE_HOST: ${{ secrets.rsync_host }} + REMOTE_USER: ${{ secrets.rsync_username }} + SOURCE: ${{ secrets.rsync_source }} + TARGET: ${{ secrets.rsync_destination }} + SSH_PRIVATE_KEY: ${{ secrets.rsync_key }} -- 2.49.0 From 2251f076c6e8e7dd89b879b4a8bda49843e05008 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 25 Sep 2025 14:56:28 +0800 Subject: [PATCH 15/18] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 测试自制镜像 --- .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 b80ceac..fb81aba 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -4,7 +4,7 @@ on: push jobs: build-and-deploy: - runs-on: ubuntu-latest + runs-on: node-22 steps: - name: Checkout uses: actions/checkout@v5 -- 2.49.0 From f4145b911acf47739b34e07ec4640e37d4b5a557 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 25 Sep 2025 14:57:10 +0800 Subject: [PATCH 16/18] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E8=87=AA?= =?UTF-8?q?=E5=88=B6=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .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 fb81aba..8a211ce 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -4,7 +4,7 @@ on: push jobs: build-and-deploy: - runs-on: node-22 + runs-on: node22-build steps: - name: Checkout uses: actions/checkout@v5 -- 2.49.0 From dbb10b7708aee1b44c2f5254aae103562ec2b829 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 25 Sep 2025 16:32:09 +0800 Subject: [PATCH 17/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在ssh部署到目标主机后,重启前端服务 --- .gitea/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8a211ce..ae4e1b7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -45,3 +45,4 @@ jobs: SOURCE: ${{ secrets.rsync_source }} TARGET: ${{ secrets.rsync_destination }} SSH_PRIVATE_KEY: ${{ secrets.rsync_key }} + SCRIPT_AFTER: ${{ secrets.script_after_rsync }} -- 2.49.0 From ef6877768a3e232196f0a5047257358f1f36c338 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Fri, 26 Sep 2025 14:33:45 +0800 Subject: [PATCH 18/18] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 只有master分支更新时执行项目部署操作 --- .gitea/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ae4e1b7..b7e741b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -26,7 +26,6 @@ jobs: ${{ runner.os }}-pnpm- - name: Install dependencies run: pnpm install - # Nuxt 构建缓存,加快二次构建 - name: Cache Nuxt build uses: actions/cache@v4 with: @@ -36,7 +35,8 @@ jobs: ${{ runner.os }}-nuxt- - name: Build project run: pnpm run build - - name: Rsync build artifact to server + - name: Deploy to server + if: github.ref == 'refs/heads/master' uses: easingthemes/ssh-deploy@main with: ARGS: "-rlgoDzvc -i --delete" -- 2.49.0