Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/example.yml
Comment thread
mercy299 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Push

on:
push:
branches:
- dev

env:
ECR_REGISTRY: ${{ secrets.VOLOMN_AWS_ECR_REGISTRY }}
ECR_FRONTEND_REPOSITORY: voauth_web
ECR_BACKEND_REPOSITORY: voauth_api
IMAGE_TAG: ${{ github.sha }}

jobs:
checkout:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have this checkout object here?

name: Checkout
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

build-push-frontend:
name: Build and Push Frontend Docker Image
runs-on: ubuntu-latest
needs: checkout

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.VOLOMN_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.VOLOMN_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build Frontend Docker Image
run: |
cd frontend
docker build --build-arg API_BASE_URL=${{ secrets.API_BASE_URL }} -t $ECR_REGISTRY/$ECR_FRONTEND_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_FRONTEND_REPOSITORY:$IMAGE_TAG

build-push-backend:
name: Build and Push Backend Docker Image
runs-on: ubuntu-latest
needs: checkout

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.VOLOMN_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.VOLOMN_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build Backend Docker Image
run: |
cd backend
docker build -t $ECR_REGISTRY/$ECR_BACKEND_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_BACKEND_REPOSITORY:$IMAGE_TAG