Merge pull request #72 from tiberiushunter/dependabot/bundler/rexml-3… #252
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: CI | |
on: [push] | |
jobs: | |
test-build: | |
name: Test Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Babel and Jest Modules | |
run: npm install | |
- name: Build Jekyll Files | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ | |
jekyll/builder:latest /bin/bash -c "chmod a+w /srv/jekyll/Gemfile.lock && chmod 777 /srv/jekyll/src && jekyll build --config _config.yml,_config.test.yml --future --trace" | |
- name: Run Jest Tests | |
run: npm run test:ci | |
production-build: | |
name: Production Build | |
runs-on: ubuntu-latest | |
needs: [test-build] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build Jekyll Files | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ | |
jekyll/builder:latest /bin/bash -c "chmod a+w /srv/jekyll/Gemfile.lock && chmod 777 /srv/jekyll/src && jekyll build --config _config.yml --future --trace" | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: built-jekyll-files | |
path: _site | |
retention-days: 1 | |
deploy: | |
name: Deployment | |
runs-on: ubuntu-latest | |
needs: [production-build] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Download built site artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: built-jekyll-files | |
path: _site | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
mask-aws-account-id: true | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-2 | |
- name: Deploy to S3 bucket | |
run: aws s3 sync ./_site/ ${{ secrets.S3_BUCKET }} --delete | |
- name: Invalidate CloudFront Objects | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DIST_ID }} --path "/*" |