Skip to content

Commit f5c5272

Browse files
Merge branch 'master' into feature_02
2 parents 6727552 + 4820e01 commit f5c5272

File tree

1 file changed

+97
-93
lines changed

1 file changed

+97
-93
lines changed

.github/workflows/build-deploy.yml

Lines changed: 97 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,106 @@
1-
name: Build and Deploy Code
1+
# name: Build and Deploy Code to Docker and Heroku
22

3-
on: [push, pull_request]
3+
# on:
4+
# push:
5+
# branches: [ master ]
6+
# pull_request:
7+
# branches: [ master ]
48

5-
jobs:
6-
build:
7-
environment:
8-
name: testing
9-
env:
10-
DATABASE_HOSTNAME: ${{secrets.DATABASE_HOSTNAME}}
11-
DATABASE_PORT: ${{secrets.DATABASE_PORT}}
12-
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
13-
DATABASE_NAME: ${{secrets.DATABASE_NAME}}
14-
DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}}
15-
SECRET_KEY: ${{secrets.SECRET_KEY}}
16-
ALGORITHM: ${{secrets.ALGORITHM}}
17-
ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}}
9+
# jobs:
10+
# build:
11+
# environment:
12+
# name: testing
13+
# env:
14+
# DATABASE_HOSTNAME: ${{secrets.DATABASE_HOSTNAME}}
15+
# DATABASE_PORT: ${{secrets.DATABASE_PORT}}
16+
# DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
17+
# DATABASE_NAME: ${{secrets.DATABASE_NAME}}
18+
# DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}}
19+
# SECRET_KEY: ${{secrets.SECRET_KEY}}
20+
# ALGORITHM: ${{secrets.ALGORITHM}}
21+
# ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}}
1822

19-
services:
20-
postgres:
21-
image: postgres
22-
env:
23-
POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
24-
POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test
25-
ports:
26-
- 5432:5432
27-
options: >-
28-
--health-cmd pg_isready
29-
--health-interval 10s
30-
--health-timeout 5s
31-
--health-retries 5
23+
# services:
24+
# postgres:
25+
# image: postgres
26+
# env:
27+
# POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
28+
# POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test
29+
# ports:
30+
# - 5432:5432
31+
# options: >-
32+
# --health-cmd pg_isready
33+
# --health-interval 10s
34+
# --health-timeout 5s
35+
# --health-retries 5
3236

33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: pulling git repo
36-
uses: actions/checkout@v2
37-
- name: Install python version 3.9
38-
uses: actions/setup-python@v2
39-
with:
40-
python-version: "3.9"
41-
- name: update pip
42-
run: python -m pip install --upgrade pip
43-
- name: install all dependencies
44-
run: pip install -r requirements.txt
45-
- name: test with pytest
46-
run: |
47-
pip install pytest
48-
pytest
37+
# runs-on: ubuntu-latest
38+
# steps:
39+
# - name: pulling git repo
40+
# uses: actions/checkout@v2
41+
# - name: Install python version 3.9
42+
# uses: actions/setup-python@v2
43+
# with:
44+
# python-version: "3.9"
45+
# - name: update pip
46+
# run: python -m pip install --upgrade pip
47+
# - name: install all dependencies
48+
# run: pip install -r requirements.txt
49+
# - name: test with pytest
50+
# run: |
51+
# pip install pytest
52+
# pytest
4953

50-
# - name: Login to Docker Hub
51-
# uses: docker/login-action@v1
52-
# with:
53-
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
54-
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
54+
# # - name: Login to Docker Hub
55+
# # uses: docker/login-action@v1
56+
# # with:
57+
# # username: ${{ secrets.DOCKER_HUB_USERNAME }}
58+
# # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
5559

56-
# - name: Set up Docker Buildx
57-
# id: buildx
58-
# uses: docker/setup-buildx-action@v1
60+
# # - name: Set up Docker Buildx
61+
# # id: buildx
62+
# # uses: docker/setup-buildx-action@v1
5963

60-
# - name: Build and push
61-
# id: docker_build
62-
# uses: docker/build-push-action@v2
63-
# with:
64-
# context: ./
65-
# file: ./Dockerfile
66-
# builder: ${{ steps.buildx.outputs.name }}
67-
# push: true
68-
# tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest
69-
# cache-from: type=local,src=/tmp/.buildx-cache
70-
# cache-to: type=local,dest=/tmp/.buildx-cache
71-
# - name: Image digest
72-
# run: echo ${{ steps.docker_build.outputs.digest }}
64+
# # - name: Build and push
65+
# # id: docker_build
66+
# # uses: docker/build-push-action@v2
67+
# # with:
68+
# # context: ./
69+
# # file: ./Dockerfile
70+
# # builder: ${{ steps.buildx.outputs.name }}
71+
# # push: true
72+
# # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest
73+
# # cache-from: type=local,src=/tmp/.buildx-cache
74+
# # cache-to: type=local,dest=/tmp/.buildx-cache
75+
# # - name: Image digest
76+
# # run: echo ${{ steps.docker_build.outputs.digest }}
7377

74-
deploy:
75-
runs-on: ubuntu-latest
76-
needs: [build]
77-
environment:
78-
name: production
79-
steps:
80-
- name: pulling git repo
81-
uses: actions/checkout@v2
82-
- name: deploying to Heroku
83-
uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
84-
with:
85-
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
86-
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
87-
heroku_email: ${{secrets.HEROKU_EMAIL}}
78+
# deploy:
79+
# runs-on: ubuntu-latest
80+
# needs: [build]
81+
# environment:
82+
# name: production
83+
# steps:
84+
# - name: pulling git repo
85+
# uses: actions/checkout@v2
86+
# - name: deploying to Heroku
87+
# uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
88+
# with:
89+
# heroku_api_key: ${{secrets.HEROKU_API_KEY}}
90+
# heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
91+
# heroku_email: ${{secrets.HEROKU_EMAIL}}
8892

89-
- name: deploy to ubuntu server
90-
uses: appleboy/ssh-action@master
91-
with:
92-
host: ${{secrets.PROD_HOST}}
93-
username: ${{secrets.PROD_USERNAME}}
94-
password: ${{secrets.PROD_PASSWORD}}
95-
script: |
96-
cd app/src
97-
git pull
98-
echo ${{secrets.PROD_PASSWORD}} | sudo -S systemctl restart api
99-
# login to our ubuntu
100-
# cd /app/src
101-
# git pull
102-
# systemctl restart api
93+
# - name: deploy to ubuntu server
94+
# uses: appleboy/ssh-action@master
95+
# with:
96+
# host: ${{secrets.PROD_HOST}}
97+
# username: ${{secrets.PROD_USERNAME}}
98+
# password: ${{secrets.PROD_PASSWORD}}
99+
# script: |
100+
# cd app/src
101+
# git pull
102+
# echo ${{secrets.PROD_PASSWORD}} | sudo -S systemctl restart api
103+
# # login to our ubuntu
104+
# # cd /app/src
105+
# # git pull
106+
# # systemctl restart api

0 commit comments

Comments
 (0)