Skip to content

Commit

Permalink
Only push frontend once new release is made to production , also publ…
Browse files Browse the repository at this point in the history
…ish release images
  • Loading branch information
kshitijrajsharma committed May 30, 2024
1 parent 4b2121d commit ec9dfab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/backend_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ on:
push:
branches:
- master
- fix/build
paths:
- 'backend/**'
- '.github/workflows/backend_build.yml'
- "backend/**"
- ".github/workflows/backend_build.yml"
pull_request:
branches:
- master
paths:
- 'backend/**'
- '.github/workflows/backend_build.yml'
- "backend/**"
- ".github/workflows/backend_build.yml"

jobs:
Build_on_ubuntu:
Expand Down Expand Up @@ -111,7 +110,7 @@ jobs:
pip install numpy
pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal"
- name : Check Opencv version
- name: Check Opencv version
run: |
pip freeze | grep opencv
pip install opencv-python-headless==4.7.0.68
Expand All @@ -121,7 +120,7 @@ jobs:
TESTING_TOKEN: ${{ secrets.TESTING_TOKEN }}
run: |
cd backend/
export TESTING_TOKEN=$TESTING_TOKEN
python manage.py makemigrations
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/docker_publish_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
branches:
- master
paths-ignore:
- '.github/workflows/backend_build.yml'
- '.github/workflows/frontend_build.yml'
- '.github/workflows/frontend_build_push.yml'
- ".github/workflows/backend_build.yml"
- ".github/workflows/frontend_build.yml"
- ".github/workflows/frontend_build_push.yml"
release:
types: [released]

env:
REGISTRY: ghcr.io
Expand Down
59 changes: 29 additions & 30 deletions .github/workflows/frontend_build_push.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
name: Frontend Build and upload to S3

on:
push:
branches: [ master ]
release:
types: [released]
paths:
- 'frontend/**'
- '.github/workflows/frontend_build_push.yml'
- "frontend/**"
- ".github/workflows/frontend_build_push.yml"

permissions:
id-token: write
contents: read

jobs:
build_and_upload:

runs-on: ubuntu-latest
environment: Production
env:
CI: false

strategy:
matrix:
node-version: [ 16.14.2 ]
node-version: [16.14.2]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: cd frontend/ && npm install --legacy-peer-deps

- name: Build frontend
run: cd frontend/ && npm run build
env:
REACT_APP_API_BASE: ${{ vars.REACT_APP_API_BASE }}
REACT_APP_PREDICTOR_API_BASE: ${{ vars.REACT_APP_PREDICTOR_API_BASE }}
REACT_APP_ENV: Dev

- name: Authenticate to AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
role-session-name: fAIrGithub

- name: Upload to S3
run: cd frontend/build && aws s3 sync . s3://${{ vars.FRONTEND_BUCKET }}/
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: cd frontend/ && npm install --legacy-peer-deps

- name: Build frontend
run: cd frontend/ && npm run build
env:
REACT_APP_API_BASE: ${{ vars.REACT_APP_API_BASE }}
REACT_APP_PREDICTOR_API_BASE: ${{ vars.REACT_APP_PREDICTOR_API_BASE }}
REACT_APP_ENV: Dev

- name: Authenticate to AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
role-session-name: fAIrGithub

- name: Upload to S3
run: cd frontend/build && aws s3 sync . s3://${{ vars.FRONTEND_BUCKET }}/

0 comments on commit ec9dfab

Please sign in to comment.