From 3bc45e12a9700622f2fe1fcc7a73b5e5269c3bc0 Mon Sep 17 00:00:00 2001 From: Zaquariah Holland Date: Mon, 12 Jul 2021 10:49:58 -0500 Subject: [PATCH] new deployment strat --- .github/workflows/build_and_deploy.yml | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 .github/workflows/build_and_deploy.yml diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml new file mode 100755 index 0000000..15dc220 --- /dev/null +++ b/.github/workflows/build_and_deploy.yml @@ -0,0 +1,34 @@ +name: CI / CD + +# Controls when the action will run. +on: + # Triggers the workflow on push for the develop branch + push: + branches: [ develop ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: 'us-west-2' + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - name: "Build Site" + run: bundle exec jekyll build + env: + JEKYLL_ENV: production + - name: "Deploy to AWS S3" + run: aws s3 sync ./_site/ s3://${{ secrets.AWS_S3_BUCKET_NAME }} --acl public-read --delete --cache-control max-age=604800 + - name: "Create AWS Cloudfront Invalidation" + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" \ No newline at end of file