Skip to content

Update

Update #161

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
# run: sudo apt-get update && sudo apt-get install --no-install-recommends --yes minify
- name: Minify
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install tdewolff/tap/minify || true
minify --type=text/html \
--match "*.html" \
--html-keep-default-attrvals \
--html-keep-document-tags \
--html-keep-end-tags \
--html-keep-quotes \
--verbose \
--recursive \
--output "./_site/" \
"./_site/"
minify --type=application/json --match "*.json" --verbose --recursive --output "./_site/" "./_site/" || true
minify --type=application/manifest+json --match "*.webmanifest" --verbose --recursive --output "./_site/" "./_site/" || 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() }}