Skip to content

Adding s3 bucket path #32

Adding s3 bucket path

Adding s3 bucket path #32

name: Cloud Resume API Challenge
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
DYNAMODB_TABLE_NAME: ${{ secrets.TABLE_NAME }}
BUCKET: ${{ secrets.BUCKET_NAME }}
DIST: ./resume/dist
DIST_ID: ${{ secrets.ID }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Dependencies
run: npm ci
working-directory: resume
- name: Build Static Website
run: npm run build
working-directory: resume
- name: Upload JSON Data to DynamoDB
run: |
aws dynamodb put-item \
--table-name ${{ secrets.TABLE_NAME }} \
--item file://files/resume.json \
--region ${{ secrets.AWS_REGION }}
- name: Copy files to the production resume website with the AWS CLI
run: |
aws s3 sync ${{ env.DIST }}/ s3://${{ env.BUCKET }} --delete
aws cloudfront create-invalidation \
--distribution-id ${{ env.DIST_ID }} \
--paths "/*"