Fixing the periodic table api for prod #21
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: Build angular app and deploy to S3 | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: npm Install | |
run: npm install | |
- name: Install Angular CLI | |
run: npm install -g @angular/cli | |
- name: Build Angular App | |
env: | |
ENVIRONMENT: ${{ vars.ENVIRONMENT }} | |
run: ng build --configuration $ENVIRONMENT | |
- name: Configure AWS credentials for Github Actions | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_ACCESS_ROLE }} | |
- name: Deploy to S3 | |
env: | |
S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
run: aws s3 sync dist/periodic-table/browser $S3_BUCKET --acl public-read |