-
Notifications
You must be signed in to change notification settings - Fork 13
52 lines (45 loc) · 1.43 KB
/
deploy-vm.yml
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
42
43
44
45
46
47
48
49
50
51
52
name: Deploy Docker Images
on:
pull_request:
branches:
- main
- development
workflow_run:
workflows:
- Build and Push Web Docker Image
- Build and Push CMS Docker Image
branches:
- development
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: setup environment file
run: |
test -f .env || cp .env.example .env
- name: copy files to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: "./docker-compose.dev.yml,./.env"
target: "~/${{ github.event.repository.name }}/"
- name: pull & start container images
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script_stop: true
script: |
cd ~/${{ github.event.repository.name }}/
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker compose -f docker-compose.dev.yml pull
docker compose -f docker-compose.dev.yml down
docker compose -f docker-compose.dev.yml up -d --wait --no-build --force-recreate
docker compose -f docker-compose.dev.yml logs -t -n 50