Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
update cicd.yml to split frontend and backend into seperate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Feb 28, 2023
1 parent cd7523c commit 97e8f2f
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ main ]

jobs:
build:
build-frontend:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -24,11 +24,9 @@ jobs:
node-version: ${{ matrix.node-version }}


- name: Install frontend dependencies
run: cd frontend && npm install

- name: Install backend dependencies
run: cd backend && npm install
- name: Install dependencies
working-directory: frontend
run: npm install

- name: Login to Docker Hub
uses: docker/login-action@v1
Expand All @@ -42,7 +40,7 @@ jobs:
uses: docker/setup-buildx-action@v1

- name: Build and push frontend
id: docker_build_frontend
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./frontend
Expand All @@ -51,8 +49,39 @@ jobs:
#Change this to whatever your repository is called
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/capstone-project-frontend:latest

- name: Build and push backend
id: docker_build_backend
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

build-backend:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]


steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
working-directory: backend
run: npm install

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./backend
Expand All @@ -61,8 +90,5 @@ jobs:
#Change this to whatever your repository is called
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/capstone-project-backend:latest

- name: Image digest for frontend
run: echo ${{ steps.docker_build_frontend.outputs.digest }}

- name: Image digest for backend
run: echo ${{ steps.docker_build_backend.outputs.digest }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 97e8f2f

Please sign in to comment.