feat(deployment): add GitHub Actions workflow for server deployment

This commit is contained in:
shiyu
2025-05-24 15:14:23 +08:00
parent 12e2023e8c
commit ab5351d250
3 changed files with 49 additions and 35 deletions

29
.github/workflows/deployment.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Deploy to Server
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v3
- name: 部署到服务器
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
docker pull ghcr.io/drizzletime/foxel:dev
docker stop foxel-container || true
docker rm foxel-container || true
docker run -d --name foxel-container -p 8848:80 \
-e "DEFAULT_CONNECTION=${{ secrets.DEFAULT_CONNECTION }}" \
--pull always ghcr.io/drizzletime/foxel:dev