Use actions/upload-artifact and download-artifact for cross-job file sharing
This commit is contained in:
+12
-16
@@ -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/
|
||||
rsync -avz --delete ./public/ root@192.168.254.5:/opt/1panel/www/sites/www.learngaming.top/index/
|
||||
Reference in New Issue
Block a user