Repository navigation
68 lines (59 loc) · 1.93 KB
/
Copy pathdeploy-staging.yaml
File metadata and controls
68 lines (59 loc) · 1.93 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Deploy Staging
on:
push:
branches: [ "develop" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: titus-system/syncdesk-api
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: deploy/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging
deploy:
needs: build-and-push
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Copy compose files to Droplet
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
target: /opt/syncdesk
source: docker-compose.yaml,deploy/docker-compose.staging.yaml,deploy/prometheus,deploy/alertmanager,deploy/loki,deploy/promtail,deploy/grafana
debug: true
timeout: 15s
command_timeout: 2m
- name: Deploy to Droplet
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /opt/syncdesk
docker compose -f docker-compose.yaml -f deploy/docker-compose.staging.yaml pull api
docker compose -f docker-compose.yaml -f deploy/docker-compose.staging.yaml up -d --force-recreate