generated from nyu-software-engineering/final-project
-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (37 loc) · 1.11 KB
/
webApp.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
name: Web App CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Build and Test Web Application
run: |
cd web-app
docker build -t web-app .
docker run --rm web-app python -m unittest discover tests
push-to-docker-hub:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Push Web Application to Docker Hub
run: |
docker build -t web-app .
docker tag web-app ${{ secrets.DOCKER_USERNAME }}/web-app:latest
docker push ${{ secrets.DOCKER_USERNAME }}/web-app:latest
deploy:
needs: push-to-docker-hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy to Digital Ocean
run: |
# Add deployment steps for Digital Ocean