-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (46 loc) · 1.57 KB
/
develop.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
name: CI/CD with Docker Compose
env:
REPO_NAME: ${{ github.event.repository.name }}
on:
push:
branches:
- develop
jobs:
build:
runs-on: [self-hosted]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ./_work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}
docker compose build --no-cache
deploy:
needs: [build]
runs-on: [self-hosted]
steps:
- name: SSH into production server and deploy
uses: appleboy/ssh-action@master
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.DEV_TELEGRAM_BOT_TOKEN }}
DEVELOPER_CHAT_ID: ${{ secrets.DEVELOPER_CHAT_ID }}
SQLITE_DB_FILE_PATH: ${{ vars.SQLITE_DB_FILE_PATH }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ./_work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}
docker compose down
docker compose up -d \
-e TELEGRAM_BOT_TOKEN=${{ secrets.DEV_TELEGRAM_BOT_TOKEN }} \
-e DEVELOPER_CHAT_ID=${{ secrets.DEVELOPER_CHAT_ID }}
docker compose ps
envs: TELEGRAM_BOT_TOKEN,DEVELOPER_CHAT_ID,SQLITE_DB_FILE_PATH