diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f6455fd..931dfd3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 \ No newline at end of file diff --git a/Gemfile b/Gemfile index a8764ec..c785fc0 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/_config.yml b/_config.yml index 788415b..2060a8b 100644 --- a/_config.yml +++ b/_config.yml @@ -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: @@ -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. # ----------------------------------------------------------------------------- diff --git a/purgecss.config.js b/purgecss.config.js new file mode 100644 index 0000000..6453ef4 --- /dev/null +++ b/purgecss.config.js @@ -0,0 +1,6 @@ +module.exports = { + content: ["_site/**/*.html", "_site/**/*.js"], + css: ["_site/assets/css/*.css"], + output: "_site/assets/css/", + skippedContentGlobs: ["_site/assets/**/*.html"], + }; \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b8b380f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +nbconvert \ No newline at end of file