偶得一图片. 顺便添加下自动部署

This commit is contained in:
wood chen 2024-09-21 15:43:47 +08:00
parent f3dae5dfa5
commit 0f7c684af8
2 changed files with 53 additions and 2 deletions

View File

@ -38,3 +38,50 @@ jobs:
push: true push: true
tags: woodchen/${{ env.IMAGE_NAME }}:latest tags: woodchen/${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
- name: Create artifact
run: |
zip -r public.zip public
- name: Deploy public directory to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: root
key: ${{ secrets.SERVER_SSH_KEY }}
source: "public.zip"
target: "/tmp"
- name: Execute deployment commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: root
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
# 解压文件
unzip -o /tmp/public.zip -d /tmp/public_temp
# 删除目标目录中的现有文件
rm -rf /opt/1panel/docker/compose/random-api-go/public/*
# 移动新文件到目标目录
mv -f /tmp/public_temp/public/* /opt/1panel/docker/compose/random-api-go/public/
# 设置目录及其子文件的所有权和权限
chown -R 1000:1000 /opt/1panel/docker/compose/random-api-go/public
chmod -R 0755 /opt/1panel/docker/compose/random-api-go/public
# 清理临时文件
rm /tmp/public.zip
rm -rf /tmp/public_temp
# 拉取镜像
docker pull woodchen/random-api-go:latest
# 停止并删除容器
docker stop random-api-go || true
docker rm random-api-go || true
# 启动容器
docker compose -f /opt/1panel/docker/compose/random-api-go/docker-compose.yml up -d

View File

@ -108,3 +108,7 @@ https://cdn-oracle.czl.net/img/2024/04/661e8ef58bfd6.webp
https://cdn-oracle.czl.net/img/2024/04/661e8ef5791e8.webp https://cdn-oracle.czl.net/img/2024/04/661e8ef5791e8.webp
#截止2024.04.26 #截止2024.04.26
# 2024.09.21 偶得一图
https://cdn-oracle.czl.net/img/2024/09/66ee76a21de75.png
1 https://cdn-oracle.czl.net/img/2024/04/661e8ef170c4b.webp
108 https://cdn-oracle.czl.net/img/2024/04/661e8ef5791e8.webp
109 #截止2024.04.26
110 # 2024.09.21 偶得一图
111 https://cdn-oracle.czl.net/img/2024/09/66ee76a21de75.png
112
113
114