-
Notifications
You must be signed in to change notification settings - Fork 7
41 lines (34 loc) · 1.2 KB
/
deploy.yml
File metadata and controls
41 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Deploy CI
run-name: ${{ github.actor }} started CI
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fail if not on master
if: github.ref != 'refs/heads/master'
run: echo "This workflow can only be run on the master branch." && exit 1
- name: Fail if not run by owner
if: github.actor != 'while1618'
run: echo "This workflow can only be run by the owner." && exit 1
- name: Copy compose file to server
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
source: docker-compose.prod.yml
target: ~/bugzkit/
- name: Deploy with Docker Compose
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
script: |
cd ~/bugzkit
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d --remove-orphans