47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Deploy to Production
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v[0-9]+.[0-9]+.[0-9]+
|
|
|
|
jobs:
|
|
deploy-to-production:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
path: .
|
|
|
|
- name: Transfer files
|
|
uses: burnett01/rsync-deployments@8.0.4
|
|
with:
|
|
switches: -azvr --delete --exclude=".gitignore" --exclude=".git" --exclude=".gitea" --exclude="data" --exclude=".env"
|
|
path: .
|
|
remote_path: /home/${{ secrets.USERNAME }}/minecraft-server-ironveil
|
|
remote_host: ${{ secrets.HOST }}
|
|
remote_user: ${{ secrets.USERNAME }}
|
|
remote_key: ${{ secrets.KEY }}
|
|
|
|
- name: Stop container
|
|
uses: appleboy/ssh-action@v1.2.5
|
|
with:
|
|
host: ${{ secrets.host }}
|
|
username: ${{ secrets.USERNAME }}
|
|
key: ${{ secrets.KEY }}
|
|
script: |
|
|
cd minecraft-server-ironveil
|
|
docker compose down
|
|
|
|
- name: Start container
|
|
uses: appleboy/ssh-action@v1.2.5
|
|
with:
|
|
host: ${{ secrets.host }}
|
|
username: ${{ secrets.USERNAME }}
|
|
key: ${{ secrets.KEY }}
|
|
script: |
|
|
cd minecraft-server-ironveil
|
|
docker compose up -d
|