-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 2.22 KB
/
pipeline.yaml
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
# The name of the workflow.
name: Build and Deploy
# Run the workflow when code is pushed to the main branch
on:
push:
branches:
- main
# This is the workflow that is being run.
jobs:
build-and-deploy:
# This is telling GitHub to run the workflow on the latest version of Ubuntu.
runs-on: ubuntu-latest
steps:
# Checkout the code from the GitHub repository
- name: Checkout code
uses: actions/checkout@v3
# Install dependencies, export environment variables to be used by application and run tests for the server application
- name: Install and Test Server
working-directory: ./server
env: # Define environment variables for this step
MONGO_URI: ${{ secrets.MONGO_URI }}
MONGO_URI_TEST: ${{ secrets.MONGO_URI_TEST }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: |
npm install
npm run test
# Build a Docker image for the client application
- name: Build Client Docker Image
working-directory: ./client
# Build image with tag rakeshpotnuru/productivity-app:client
run: |
docker build -t chrisantiago217/opendoors:client-${{github.run_number}} -t chrisantiago217/opendoors:client-latest .
# Build a Docker image for the server application
- name: Build Server Docker Image
working-directory:
./server
# Build image with tag rakeshpotnuru/productivity-app:server
run: |
docker build -t chrisantiago217/opendoors:server-${{github.run_number}} -t chrisantiago217/opendoors:server-latest .
# Log in to Docker Hub using credentials from repository secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Push the Docker images to Docker Hub
- name: Push Docker Images to Docker Hub
run: |
docker push chrisantiago217/opendoors:client-${{github.run_number}}
docker push chrisantiago217/opendoors:server-${{github.run_number}}
docker push chrisantiago217/opendoors:client-latest
docker push chrisantiago217/opendoors:server-latest