Skip to content
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
#This is a basic workflow to help you get started with Actions
name: Build UI, Push to Dev
name: Build/Push UI to Dev, Test, or Prod

# Controls when the action will run. Invokes the workflow on push events but only for the main branch
on:
push:
branches: [cwbi-dev]
branches: [cwbi-dev, cwbi-test] # cwbi-prod
# Allow the workflow to be triggered manually from the GitHub UI
workflow_dispatch:

env:
AWS_REGION: us-gov-west-1 #Change to reflect your Region
ROLE_TO_ASSUME: arn:aws-us-gov:iam::718787032875:role/github-actions-s3-hhc-workforce
VITE_MODE: dev
S3_BUCKET: hhc-shared-dev
S3_BUCKET_PREFIX: workforce/ui

# Permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
Build-Push-UI-to-Dev:
Build-Push-UI-to-Env:
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set Branch attributes
id: set-attributes
run: |
case "${GITHUB_REF##*/}" in
"cwbi-dev")
echo "ROLE_TO_ASSUME=arn:aws-us-gov:iam::718787032875:role/github-actions-s3-hhc-workforce" >> $GITHUB_ENV
echo "BUILD_MODE=dev" >> $GITHUB_ENV
echo "S3_BUCKET=hhc-shared-dev" >> $GITHUB_ENV
echo "S3_BUCKET_PREFIX=workforce/ui" >> $GITHUB_ENV
;;
"cwbi-test")
echo "ROLE_TO_ASSUME=arn:aws-us-gov:iam::276847049069:role/github-actions-s3-hhc-workforce" >> $GITHUB_ENV
echo "BUILD_MODE=test" >> $GITHUB_ENV
echo "S3_BUCKET=hhc-shared-test" >> $GITHUB_ENV
echo "S3_BUCKET_PREFIX=workforce/ui" >> $GITHUB_ENV
;;
"cwbi-prod")
echo "ROLE_TO_ASSUME=arn:aws-us-gov:iam::648157167324:role/github-actions-s3-hhc-workforce" >> $GITHUB_ENV
echo "BUILD_MODE=prod" >> $GITHUB_ENV
echo "S3_BUCKET=hhc-shared-prod" >> $GITHUB_ENV
echo "S3_BUCKET_PREFIX=workforce/ui" >> $GITHUB_ENV
;;
esac

- name: Display Attributes
run: |
echo "ROLE_TO_ASSUME: $ROLE_TO_ASSUME"
echo "BUILD_MODE: $BUILD_MODE"
echo "S3_BUCKET: $S3_BUCKET"
echo "S3_BUCKET_PREFIX: $S3_BUCKET_PREFIX"

# Step 2: Set up Node.js (React app requires Node.js)
- name: Set up Node.js
Expand All @@ -44,7 +71,7 @@ jobs:

# Step 4: Build the React app for production
- name: Build React App with Vite
run: npx vite build --mode ${{ env.VITE_MODE }}
run: npx vite build --mode ${{ env.BUILD_MODE }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down