-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (32 loc) · 1.03 KB
/
build-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
name: Go Backend CI/CD
on:
push:
branches: [ "deploy" ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build Prod Docker Image
run: docker build -t jokil/esefexapi:latest -f EsefexApi/Dockerfile EsefexApi
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker Image
run: docker push jokil/esefexapi:latest
- name: Deploy to production
uses: appleboy/[email protected]
with:
host: ${{ vars.HOST }}
username: ${{ vars.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd api
docker compose down
> .env.github
echo BOT_TOKEN=${{ secrets.BOT_TOKEN }} >> .env.github
docker compose pull
docker compose up -d