-
-
Notifications
You must be signed in to change notification settings - Fork 12
64 lines (54 loc) · 2.01 KB
/
deploy.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
53
54
55
56
57
58
59
60
61
62
63
64
name: Deployment BETA
on:
release:
types: [published]
jobs:
test:
uses: ./.github/workflows/test-build.yml
deploy:
runs-on: self-hosted
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: beta
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get production data
run: |
cp ../.env .env
cp ../docker-compose.override.yml docker-compose.override.yml
- name: Check if .env file has content
run: |
if grep -q . .env; then
echo ".env file is not empty"
else
echo ".env file is empty"
echo "stop_workflow=true" >> $GITHUB_OUTPUT
fi
- name: Check if docker-compose.override.yml file has content
run: |
if grep -q . docker-compose.override.yml; then
echo "docker-compose.override.yml file is not empty"
else
echo "docker-compose.override.yml file is empty"
echo "stop_workflow=true" >> $GITHUB_OUTPUT
fi
- name: Build
run: |
export NODE_ENV=production
docker compose down && docker compose up -d
- name: Wait 60 seconds and check if all containers are healthy
run: |
sleep 60
docker ps -a
docker inspect --format='{{json .State.Health}}' mittelbot
docker inspect --format='{{json .State.Health}}' mittelbot-mysql
- name: Stop Workflow
if: steps.check_condition.outputs.stop_workflow == 'true'
run: |
echo "Stopping workflow"
exit 0