From 7ad937b89d2760ab7f5400139e8d83239ff04d7c Mon Sep 17 00:00:00 2001 From: Kyle Conrad Date: Wed, 18 Sep 2024 21:25:32 -0400 Subject: [PATCH] Adding deployment tasks --- .github/workflows/deploy.yml | 27 +++++++++++++++++++++++++++ deploy.sh | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..653d8d5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,27 @@ +name: Deploy Website + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - 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 + - name: Install modules + run: npm ci + - name: Build application + run: npm run build + - name: Deploy to S3 + run: aws s3 sync --delete ./dist/ s3://${{ secrets.BUCKET_ID }} + - name: Create CloudFront invalidation + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index ba2ce77..9eb3078 100755 --- a/deploy.sh +++ b/deploy.sh @@ -2,4 +2,4 @@ source .env -# aws s3 sync --delete ./dist/ s3://$AWS_BUCKET && aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/*" \ No newline at end of file +aws s3 sync --delete ./dist/ s3://$AWS_BUCKET && aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/*" \ No newline at end of file