forked from Faylixe/ceri-m1-ecommerce-2022
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) · 1.1 KB
/
backend.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: Backend
on: [push, pull_request]
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
cache: "pip" # caching pip dependencies
- run: |
python -m pip install --upgrade pip
pip install -r ./backend/requirements.txt
- name: Run pytest
run : |
pytest
deploy:
needs: [pytest]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Login
run: echo "${{ secrets.DOCKER_REGISTRY_PASSWORD }}" | docker login --username ${{ secrets.DOCKER_REGISTRY_USERNAME }} --password-stdin ${{ secrets.DOCKER_REGISTRY }}
- name: Build and push
run: |
docker build -t ${{ secrets.DOCKER_REGISTRY }}/backend:1.1.7 ./backend --build-arg env=${{ secrets.ENV}}
docker push ${{ secrets.DOCKER_REGISTRY }}/backend:1.1.7