From 6b65ce3c8bdacc70124042558343343f0ef37343 Mon Sep 17 00:00:00 2001 From: z9130 <984661593@qq.com> Date: Mon, 16 Sep 2024 19:27:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/build-act?= =?UTF-8?q?ion.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-action.yaml | 31 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/build-action.yaml b/.gitea/workflows/build-action.yaml index 66d1cda8..6f9716dc 100644 --- a/.gitea/workflows/build-action.yaml +++ b/.gitea/workflows/build-action.yaml @@ -15,18 +15,15 @@ jobs: steps: - # - name: Install Git - # run: | - # apt-get update - # apt-get install -y git - + # Output Node.js and npm version - name: Output Node.js and npm version run: | echo "Node.js version:" node -v echo "npm version:" npm -v - + + # Clone repository - name: Clone repository run: | echo "Cloning repository..." @@ -35,6 +32,7 @@ jobs: git checkout test echo "Repository cloned and checked out to test branch." + # Set NPM registry - name: Set NPM registry run: | echo "Setting NPM registry..." @@ -48,25 +46,38 @@ jobs: npm install -g pnpm echo "pnpm installed." + # Cache pnpm dependencies + - name: Cache pnpm store + uses: actions/cache@v3 + id: pnpm-cache + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pansoft-plrl/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + # Install dependencies and build - name: Install dependencies and build run: | cd pansoft-plrl echo "Installing dependencies..." - pnpm install --no-frozen-lockfile + pnpm install echo "Dependencies installed." echo "Building project..." pnpm build --filter ${{ matrix.project }} echo "Project built." - + + # Transfer files to target server - name: Transfer files to target server run: | echo "Transferring files..." cd pansoft-plrl echo "Local files in the directory:" ls - sshpass -p "zxs123123" scp -o StrictHostKeyChecking=no -r ./apps/${{ matrix.project }}/dist.zip root@172.19.183.27:/opt/pansoft + sshpass -p "zxs123123" scp -o StrictHostKeyChecking=no -r ./apps/web-office/dist.zip root@172.19.183.27:/opt/pansoft echo "Files transferred." + # Execute remote commands - name: Execute remote commands run: | echo "Executing remote commands..." @@ -76,4 +87,4 @@ jobs: echo "Old files removed." mv /opt/pansoft/dist/* /opt/pansoft/ echo "Deployment complete." - EOF + EOF \ No newline at end of file