Skip to content

Commit

Permalink
Add Additional Secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Nov 19, 2024
1 parent 9a77542 commit 9fb5e60
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ jobs:
include:
- target: COTAK
s3_prod: COTAK_PRODUCTION
api_url: 'https://map.cotak.gov/api'
s3_staging: COTAK_STAGING
api_url: COTAK_PRODUCTION_API
staging_api_url: COTAK_STAGING_API
- target: WFTAK
s3_prod: WFTAK_PRODUCTION
api_url: 'https://etl.wftak.wildfire.gov/api'
s3_staging: WFTAK_STAGING
api_url: WFTAK_PRODUCTION_API
staging_api_url: WFTAK_STAGING_API
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -39,31 +43,44 @@ jobs:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: NPM Install
working-directory: ./api/web/
run: npm install

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws-us-gov:iam::${{secrets.AWS_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_REGION}}

- name: NPM Install
working-directory: ./api/web/
run: npm install

- name: NPM Build
working-directory: ./api/web/
run: API_URL='' npm run build
run: API_URL='${{ secrets[api_url] }}' npm run build

- name: AWS S3 CP
working-directory: ./api/web/
run: aws s3 cp --recursive dist/ s3://${{ secrets[matrix.s3_prod] }}/${{github.event.pull_request.head.sha || github.sha}}/
env:
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID}}
AWS_REGION: ${{secrets.AWS_REGION}}

- name: Clean Dist
working-directory: ./api/web/
run: rm -rf dist/

- name: Configure AWS Credentials (STAGING)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_STAGING_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_STAGING_REGION}}

- name: NPM Build
working-directory: ./api/web/
run: API_URL='${{ secrets[staging_api_url] }}' npm run build

- name: AWS S3 CP
working-directory: ./api/web/
run: aws s3 cp --recursive dist/ s3://${{ secrets[matrix.s3_staging] }}/${{github.event.pull_request.head.sha || github.sha}}/

- name: Clean Dist
working-directory: ./api/web/
run: rm -rf dist/

0 comments on commit 9fb5e60

Please sign in to comment.