-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (50 loc) · 1.54 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
name: dit-devops-project
on:
push:
branches: [ deployment ]
pull_request:
branches: [ deployment ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pytest
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to dockerhub
uses: docker/build-push-action@v5
with:
context:
push: true
tags: barryma22/dit-devops-project:latest
- name: Trigger Render Deployment
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
run: |
curl -X POST -H "Authorization: Bearer $RENDER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"serviceId": "your-service-id"}' \
https://api.render.com/v1/services/your-service-id/deploys