Skip to content

Commit

Permalink
update deploy workflow and pull from alshedivat/al-folio
Browse files Browse the repository at this point in the history
  • Loading branch information
LZhengisme committed Jan 22, 2025
1 parent 05d7587 commit dc75551
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 43 deletions.
113 changes: 86 additions & 27 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,101 @@
name: deploy
name: Deploy site

on:
push:
branches:
- master
- main
paths:
- "assets/**"
- "**.bib"
- "**.html"
- "**.js"
- "**.liquid"
- "**/*.md"
- "**.yml"
- "Gemfile"
- "Gemfile.lock"
- "!.github/workflows/axe.yml"
- "!.github/workflows/broken-links.yml"
- "!.github/workflows/deploy-docker-tag.yml"
- "!.github/workflows/deploy-image.yml"
- "!.github/workflows/docker-slim.yml"
- "!.github/workflows/lighthouse-badger.yml"
- "!.github/workflows/prettier.yml"
- "!lighthouse_results/**"
- "!CONTRIBUTING.md"
- "!CUSTOMIZE.md"
- "!FAQ.md"
- "!INSTALL.md"
- "!README.md"
pull_request:
branches:
- master
- main
paths:
- "assets/**"
- "**.bib"
- "**.html"
- "**.js"
- "**.liquid"
- "**/*.md"
- "**.yml"
- "Gemfile"
- "Gemfile.lock"
- "!.github/workflows/axe.yml"
- "!.github/workflows/broken-links.yml"
- "!.github/workflows/deploy-docker-tag.yml"
- "!.github/workflows/deploy-image.yml"
- "!.github/workflows/docker-slim.yml"
- "!.github/workflows/lighthouse-badger.yml"
- "!.github/workflows/prettier.yml"
- "!lighthouse_results/**"
- "!CONTRIBUTING.md"
- "!CUSTOMIZE.md"
- "!FAQ.md"
- "!INSTALL.md"
- "!README.md"
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.2'
bundler-cache: true
- name: Install deps
run: |
npm install -g mermaid.cli
- name: Setup deploy options
id: setup
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ ${GITHUB_REF} = refs/pull/*/merge ]]; then # pull request
echo "::set-output name=SRC_BRANCH::${GITHUB_HEAD_REF}"
echo "::set-output name=NO_PUSH::--no-push"
elif [[ ${GITHUB_REF} = refs/heads/* ]]; then # branch, e.g. master, source etc
echo "::set-output name=SRC_BRANCH::${GITHUB_REF#refs/heads/}"
fi
echo "::set-output name=DEPLOY_BRANCH::gh-pages"
- name: Deploy website
run: yes | bash bin/deploy --verbose ${{ steps.setup.outputs.NO_PUSH }}
--src ${{ steps.setup.outputs.SRC_BRANCH }}
--deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }}
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Setup Ruby 💎
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3.5"
bundler-cache: true
- name: Setup Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip" # caching pip dependencies
- name: Update _config.yml ⚙️
uses: fjogeleit/yaml-update-action@main
with:
commitChange: false
valueFile: "_config.yml"
propertyPath: "giscus.repo"
value: ${{ github.repository }}
- name: Install and Build 🔧
run: |
sudo apt-get update && sudo apt-get install -y imagemagick
pip3 install --upgrade nbconvert
export JEKYLL_ENV=production
bundle exec jekyll build
- name: Purge unused CSS 🧹
run: |
npm install -g purgecss
purgecss -c purgecss.config.js
- name: Deploy 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _site
29 changes: 20 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
source 'https://rubygems.org'

gem 'jekyll'

# Core plugins that directly affect site building
group :jekyll_plugins do
gem 'jekyll'
gem 'jekyll-archives'
gem 'jekyll-diagrams'
gem 'jekyll-email-protect'
gem 'jekyll-feed'
gem 'jekyll-get-json'
gem 'jekyll-imagemagick'
gem 'jekyll-jupyter-notebook'
gem 'jekyll-link-attributes'
gem 'jekyll-minifier'
gem 'jekyll-paginate-v2'
gem 'jekyll-regex-replace'
gem 'jekyll-scholar'
gem 'jekyll-sitemap'
gem 'jekyll-target-blank'
gem 'jekyll-tabs'
gem 'jekyll-toc'
gem 'jekyll-twitter-plugin'
gem 'jekyll-redirect-from'
gem 'jemoji'
gem 'mini_racer'
gem 'unicode_utils'
gem 'webrick'
gem 'jekyll-loading-lazy'

gem 'classifier-reborn' # used for content categorization during the build
end

# Gems for development or external data fetching (outside :jekyll_plugins)
group :other_plugins do
gem 'httparty'
gem 'css_parser'
gem 'feedjira'
gem 'httparty'
gem 'observer' # used by jekyll-scholar
gem 'ostruct' # used by jekyll-twitter-plugin
# gem 'unicode_utils' -- should be already installed by jekyll
# gem 'webrick' -- should be already installed by jekyll
end
17 changes: 10 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,25 @@ keep_files:
- .nojekyll
- .git

# Plug-ins
# Plug-ins
plugins:
- jekyll-archives
- jekyll-diagrams
- jekyll-email-protect
- jekyll-feed
- jekyll-get-json
- jekyll-imagemagick
- jekyll-jupyter-notebook
- jekyll-link-attributes
- jekyll-minifier
- jekyll-paginate-v2
- jekyll-regex-replace
- jekyll/scholar
- jekyll-sitemap
- jekyll-target-blank
- jekyll-tabs
- jekyll-toc
- jekyll-twitter-plugin
- jekyll-redirect-from
- jemoji
- jekyll-loading-lazy

# Sitemap settings
defaults:
Expand Down Expand Up @@ -269,9 +272,9 @@ imagemagick:
# Jekyll Diagrams
# -----------------------------------------------------------------------------

jekyll-diagrams:
# configuration, see https://github.com/zhustec/jekyll-diagrams.
# feel free to comment out this section if not using jekyll diagrams.
# jekyll-diagrams:
# # configuration, see https://github.com/zhustec/jekyll-diagrams.
# # feel free to comment out this section if not using jekyll diagrams.


# -----------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions purgecss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
content: ["_site/**/*.html", "_site/**/*.js"],
css: ["_site/assets/css/*.css"],
output: "_site/assets/css/",
skippedContentGlobs: ["_site/assets/**/*.html"],
};
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nbconvert

0 comments on commit dc75551

Please sign in to comment.