From 59cc2f1a623adfcedcc5e5825c62a15d8382147c Mon Sep 17 00:00:00 2001 From: YaoLei <1049031269@qq.com> Date: Mon, 6 Jul 2026 14:06:53 +0800 Subject: [PATCH] Use actions/upload-artifact and download-artifact for cross-job file sharing --- .gitea/workflows/deploy.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5c2eb20..c36be7b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -6,7 +6,6 @@ jobs: runs-on: act_runner1 container: image: 192.168.254.5:5000/hugo:v0.163.3 - options: -v /tmp:/tmp steps: - name: Create Hugo site run: | @@ -29,32 +28,29 @@ jobs: set -e hugo --minify - - name: Copy public directory to shared location - run: | - set -e - mkdir -p /tmp/shared/public - cp -r /tmp/hugo-site/public/* /tmp/shared/public/ - - - name: Show generated files - run: | - echo "Shared public directory contents:" - ls -la /tmp/shared/public || true + - name: Upload public directory + uses: actions/upload-artifact@v3 + with: + name: public + path: /tmp/hugo-site/public deploy: runs-on: act_runner1 needs: build - container: - image: alpine:latest - options: -v /tmp:/tmp steps: + - name: Download public directory + uses: actions/download-artifact@v3 + with: + name: public + path: ./public + - name: Deploy via rsync run: | set -e - apk add --no-cache rsync openssh-client # Setup SSH key for rsync mkdir -p ~/.ssh echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -H 192.168.254.5 >> ~/.ssh/known_hosts # Deploy using rsync - rsync -avz --delete /tmp/shared/public/ root@192.168.254.5:/opt/1panel/www/sites/www.learngaming.top/index/ \ No newline at end of file + rsync -avz --delete ./public/ root@192.168.254.5:/opt/1panel/www/sites/www.learngaming.top/index/ \ No newline at end of file