Skip to content

Refactor App.js

Refactor App.js #50

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
ECR_REPO: 982250989342.dkr.ecr.us-west-1.amazonaws.com
DOCKER_URL: 982250989342.dkr.ecr.us-west-1.amazonaws.com/bingoapp
DOCKER_TAG: ${{ github.sha }}
TARGET_REPO: "git@github.com:TNTSPLASH-ORG/terraform-bingoapp.git"
BRANCH: "main"
FILE: "variables.tf"
SEARCH_KEY: "bingoapp:"
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
jobs:
build:
name: Build Project
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: install
run: npm install react-scripts
- name: build
run: npm run build
- name: docker
if: github.ref == 'refs/heads/main'
run: docker build -t ${DOCKER_URL}:${GITHUB_SHA} .
- name: Configure AWS Credentials
if: github.ref == 'refs/heads/main'
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: us-west-1
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GithubAction
- name: login
if: github.ref == 'refs/heads/main'
run: aws ecr get-login-password | docker login --username AWS --password-stdin ${ECR_REPO}
- name: push
if: github.ref == 'refs/heads/main'
run: docker push ${DOCKER_URL}:${GITHUB_SHA}
- name: tag main-latest
if: github.ref == 'refs/heads/main'
run: |
docker tag ${DOCKER_URL}:${GITHUB_SHA} ${DOCKER_URL}:main-latest
docker push ${DOCKER_URL}:main-latest
update:
name: Update ECS
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: TNTSPLASH-ORG/update-service@87a0528b72381696ce9ae76b4efd9d41f4f59bd0