New redirect #28
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
# This is the name of our workflow. | |
# Github will show it on its Website UI | |
name: deploy | |
# This configures our workflow to be triggered | |
# only when we push to the master branch | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
RUBY_VERSION: "3.1.2" | |
BUNDLER_VERSION: "2.3.21" | |
# Here is where we define our jobs. | |
# Which means the tasks we want Github to execute | |
jobs: | |
build: | |
name: build | |
# Here we specify in whith OS we want it to run | |
runs-on: ubuntu-latest | |
# Now we define which actions will take place. | |
# One after another | |
steps: | |
# This is the first action. It will make sure that we have | |
# all the necessary files from our repo, including our custom actions | |
# This action here is actually from a remote repo available from Githup itself | |
- name: 🛎 Checkout master | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: ⚡️ Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends bats build-essential ca-certificates curl make shellcheck libgsl-dev libffi-dev minify | |
sudo gem install bundler:${{ env.BUNDLER_VERSION }} | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Checking Jekyll configuration | |
run: bundle exec jekyll doctor | |
- name: Cache jekyll | |
uses: actions/cache@v3 | |
with: | |
path: "_site/" | |
key: ${{ runner.os }}-${{ github.sha }} | |
- name: 🔨 Build site | |
run: | | |
bundle exec jekyll build --trace --verbose --lsi | |
env: | |
JEKYLL_ENV: production | |
- name: Optimize | |
run: | | |
minify -r -o _site/ --html-keep-document-tags --html-keep-end-tags --html-keep-default-attrvals --html-keep-whitespace --verbose _site | |
deploy: | |
if: github.event_name == 'push' | |
name: deploy | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use cache | |
uses: actions/cache@v3 | |
with: | |
path: "_site/" | |
key: ${{ runner.os }}-${{ github.sha }} | |
- name: 🎉 Deploy to GitHub Pages 🎊 | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v2 | |
with: | |
target_branch: gh-pages | |
build_dir: _site | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use cache | |
uses: actions/cache@v3 | |
with: | |
path: "_site/" | |
key: ${{ runner.os }}-${{ github.sha }} | |
- name: ⚡️ Cache HTMLProofer | |
id: cache-htmlproofer | |
uses: actions/cache@v2 | |
with: | |
path: tmp/.htmlproofer | |
key: ${{ runner.os }}-htmlproofer | |
- name: 📉 Check HTML | |
uses: chabad360/htmlproofer@master | |
continue-on-error: true | |
with: | |
directory: "./_site" | |
# The directory to scan | |
arguments: | | |
--only-4xx true | |
--assume-extension ".html" | |
--ignore-status-codes "400,403,409,429" | |
--allow-hash-href true | |
--ignore-empty-alt true | |
--cache '{ "timeframe": { "external": "7d" } }' |