-
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (90 loc) · 2.85 KB
/
main.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Test and Deploy to Heroku
on:
push:
branches:
- main
- deployment
jobs:
build-test-deploy-ui:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 14
- name: Install dependencies
run: |
cd ui
npm --version
npm install
- name: Build the Docker image
run: make build-ui
env:
BUILD_SHA: ${{ github.sha }}
- name: Log in to Heroku Container Registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Push Docker image to Heroku
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
docker images
docker tag prompt_sail_promptsail-ui:latest registry.heroku.com/promptsail/web
docker push registry.heroku.com/promptsail/web
- name: Release to Heroku
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release web -a promptsail
build-test-deploy-backend:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:latest
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- 27017:27017
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
cd backend
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Install backend dependencies
run: cd backend && poetry install
- name: Run tests
run: |
cd backend
poetry run bash -c "cd .. && MONGO_URL=mongodb://root:password@localhost:27017 make test"
- name: Build the Docker image
run: make build-backend
env:
BUILD_SHA: ${{ github.sha }}
- name: Log in to Heroku Container Registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Push Docker image to Heroku
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
docker images
docker tag prompt_sail_promptsail-backend:latest registry.heroku.com/promptsail-backend/web
docker push registry.heroku.com/promptsail-backend/web
- name: Release to Heroku
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release web -a promptsail-backend