feat: 备份 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Compose Management | |
on: | |
push: | |
branches: [ "master" ] # 触发条件:推送到 master 分支 | |
workflow_dispatch: # 手动触发工作流 | |
jobs: | |
manage_containers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 打印信息 🎉 | |
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: 打印操作系统信息 🐧 | |
run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: 打印分支和仓库信息 🔎 | |
run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: 检查仓库代码 👁︎ | |
uses: actions/checkout@v4 | |
- name: 打印仓库文件列表 📦 | |
run: ls ${{ github.workspace }} | |
- name: 打包代码成 ZIP 文件 📦 | |
run: | | |
zip -r code.zip . -x "*.git*" | |
- name: 查看 zip 文件 📦 | |
run: | | |
ls | |
- name: 推送到备份服务器 | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
LASTSSH: "Doing something after copying" | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
user: ${{ secrets.SERVER_USER}} | |
pass: ${{ secrets.SERVER_PASSWORD }} | |
scp: | | |
./code.zip => /opt/app/zip/code.zip | |
last_ssh: | | |
ls | |
- name: 打印作业状态 🍏 | |
run: echo "🍏 This job's status is ${{ job.status }}." |