ci: Add deploy script #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Staging Frontend | |
on: | |
push: | |
branches: | |
- deploy | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
environment: [stacadmin-eoapirisk-demo] | |
runs-on: ubuntu-latest | |
environment: ${{ matrix.environment }} | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: npm install | |
- name: Build code | |
env: | |
REACT_APP_STAC_API: ${{ secrets.STAC_API }} | |
run: npm run build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
env: | |
ROLE: ${{ secrets.DEPLOY_ROLE_ARN }} | |
with: | |
role-to-assume: ${{ env.ROLE }} | |
aws-region: us-west-2 | |
- name: Sync with S3 bucket | |
env: | |
BUCKET: ${{ secrets.S3_BUCKET }} | |
run: | | |
aws s3 sync \ | |
./build "s3://${BUCKET}" \ | |
--acl public-read \ | |
--follow-symlinks \ | |
--delete |