Skip to content

Merge branch 'main' of github.com:Tea-Fi/presale-ui into dev #194

Merge branch 'main' of github.com:Tea-Fi/presale-ui into dev

Merge branch 'main' of github.com:Tea-Fi/presale-ui into dev #194

Workflow file for this run

name: Build and Deploy to DEV AWS CloudFront
on:
push:
branches:
- dev
env:
CI: "true"
CLOUDFRONT_DISTRIBUTION_ID: "E21XWVH2JTBKV3"
BUCKET_NAME: "dev-presale.tea-fi.com"
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: dawnbreather/cicd_toolset:node18-buster-slim-build202301171630
env:
CI: 'true'
ENV: '${{ vars.DEV_ENV }}'
steps:
- uses: actions/checkout@v3
- run: |
echo "${{ vars.DEV_ENV }}" > .env
- run: npm install
- run: CI=false npm run build
- uses: actions/upload-artifact@v3
with:
name: build
path: dist
retention-days: 1
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
container: dawnbreather/cicd_toolset:node18-buster-slim-build202301171630
env:
CI: 'true'
AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
AWS_DEFAULT_REGION: 'us-east-1'
AWS_REGION: 'us-east-1'
steps:
- uses: actions/download-artifact@v3
with:
name: build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
- run: aws s3 sync --no-progress ./ s3://${BUCKET_NAME}/ --delete
- run: aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRIBUTION_ID} --paths '/*'