省略镜像传输过程
Some checks failed
Build and Deploy / build (push) Successful in 31s
Build and Deploy / deploy (push) Failing after 21s

This commit is contained in:
cheney 2026-08-28 17:20:22 +08:00
parent ab3548837a
commit 39abb1974d

View File

@ -21,27 +21,11 @@ jobs:
docker build -t awesome-index:${{ github.sha }} . docker build -t awesome-index:${{ github.sha }} .
docker tag awesome-index:${{ github.sha }} awesome-index:latest docker tag awesome-index:${{ github.sha }} awesome-index:latest
- name: Save Docker image
run: |
docker save awesome-index:latest | gzip > awesome-index.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: awesome-index.tar.gz
retention-days: 1
deploy: deploy:
needs: build needs: build
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docker-image
- name: Deploy to server - name: Deploy to server
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master
with: with:
@ -70,10 +54,6 @@ jobs:
script: | script: |
cd /app/awesome cd /app/awesome
# 加载镜像
gunzip -c awesome-index.tar.gz | docker load || true
rm -f awesome-index.tar.gz
# 停止旧容器 # 停止旧容器
docker compose down --remove-orphans 2>/dev/null || true docker compose down --remove-orphans 2>/dev/null || true