Skip to content

Bug fix

Bug fix #150

Workflow file for this run

# Workflow for building and deploying a Jekyll site to GitHub Pages
name: pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths-ignore:
- "**"
- "!.github/workflows/**"
- "!_config.yml"
- "!src/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
# Not needed with a .ruby-version file
ruby-version: "3.1"
# Runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Version info
run: |
ruby --version
gem --version
bundle --version
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Checking Jekyll configuration
run: bundle exec jekyll doctor
- name: Checking Markdown files
run: bundle exec mdl --ignore-front-matter --style .mdl_style.rb src/_posts || true
- name: Build with Jekyll
# Outputs to the './_site' directory by default
# run: bundle exec jekyll build --baseurl ${{ steps.pages.outputs.base_path }}
# run: JEKYLL_ENV=production bundle exec jekyll build --profile --trace --verbose
run: bundle exec jekyll build --profile --trace
env:
JEKYLL_ENV: production
- name: Install Minify deb package on Ubuntu
# if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install --no-install-recommends --yes minify
# Setup Go using Homebrew
# - name: Install Go using Homebrew
# run: |
# brew install go || true
# brew unlink go && brew link --overwrite --dry-run go || true
# brew link --overwrite go || true
# https://github.com/tdewolff/homebrew-tap/
# - name: Install Minify using Homebrew
# run: brew install tdewolff/tap/minify || true
# https://github.com/tdewolff/minify/tree/master/cmd/minify#usage
- name: Minify HTML files
run: |
minify --type=text/html \
--html-keep-default-attrvals \
--html-keep-document-tags \
--html-keep-end-tags \
--html-keep-quotes \
--verbose \
--recursive --output "./_site/" --match="\.html$" "./_site/"
- name: Minify JSON files
run: |
minify --type=application/json --recursive --output "./_site/" --match="\.json$" "./_site/" --verbose || true \
&& \
minify --type=application/manifest+json --output . "./_site/manifest.webmanifest" --verbose || true
- name: Checking HTML files
run: |
bundle exec htmlproofer ./_site/ \
--no-enforce-https \
--ignore-files "/.+\/example-content.+/,/.+\/googleca1cec34378dc996.html/,/.+\/pinterest-eac13.html/,/.+\/random\/index.html/,/.+\/style-guide\/index.html/" \
--ignore-status-codes "403,429" \
--only-4xx \
|| true
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v2
if: ${{ success() && github.repository == 'milanaryal/milanaryal.github.io' && github.ref == 'refs/heads/main' }}
with:
path: ./_site/
- name: Cleaning up
run: bundle exec jekyll clean
# Deployment job
deploy:
name: deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: ${{ github.repository == 'milanaryal/milanaryal.github.io' && github.ref == 'refs/heads/main' }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
if: ${{ success() }}