-
Notifications
You must be signed in to change notification settings - Fork 299
36 lines (30 loc) · 1.38 KB
/
staging.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
name: Deploy Backend in Development Enviroment
on:
push:
branches: [staging]
jobs:
build:
if: github.repository == 'SOS-RS/backend'
runs-on: stg
steps:
- uses: actions/checkout@v4
- name: Create .env file
run: |
touch .env
echo TZ=${{ secrets.TZ }} >> .env
echo DB_HOST=${{ secrets.DB_HOST }} >> .env
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
echo DB_USER=${{ secrets.DB_USER }} >> .env
echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env
echo DB_DATABASE_NAME=${{ secrets.STG_DB_DATABASE_NAME }} >> .env
echo DATABASE_URL=postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@${{ secrets.DB_HOST }}:${{ secrets.DB_PORT }}/${{ secrets.STG_DB_DATABASE_NAME }}?schema=public >> .env
echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env
echo HOST=${{ secrets.HOST }} >> .env
echo PORT=${{ secrets.PORT }} >> .env
echo HMAC_SECRET_KEY=${{ secrets.HMAC_SECRET_KEY }} >> .env
echo SERVER_USER_PASSWORD=${{ secrets.SERVER_USER_PASSWORD }} >> .env
cat .env
- name: Remove old docker image
run: echo ${{ secrets.SERVER_USER_PASSWORD }} | sudo -S docker compose down --rmi all
- name: Create new docker image
run: echo ${{ secrets.SERVER_USER_PASSWORD }} | sudo -S docker compose up -d --force-recreate