Skip to content

Merge pull request #66 from tiberiushunter/dependabot/bundler/actives… #239

Merge pull request #66 from tiberiushunter/dependabot/bundler/actives…

Merge pull request #66 from tiberiushunter/dependabot/bundler/actives… #239

Workflow file for this run

name: CI
on: [push]
jobs:
test-build:
name: Test Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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@v2
- 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@v2
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@v2
with:
name: built-jekyll-files
path: _site
- 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: 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 "/*"