From bacfc94c7073ac7f0565859d67bb9ea871185fd5 Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Fri, 4 Feb 2022 23:31:41 -0600 Subject: [PATCH] Workflow to build minified docs --- .github/workflows/jekyll.yml | 75 ++++++++++++++++++++++++++++++++++++ docs/Gemfile | 1 + docs/Gemfile.lock | 15 ++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/workflows/jekyll.yml diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml new file mode 100644 index 00000000..a17e17ef --- /dev/null +++ b/.github/workflows/jekyll.yml @@ -0,0 +1,75 @@ +name: Build and deploy jekyll site + +on: + push: + branches: + - master + # - source + # It is highly recommended that you only run this action on push to a + # specific branch, eg. master or source (if on *.github.io repo) + +jobs: + jekyll: + runs-on: ubuntu-latest # can change this to ubuntu-latest if you prefer + steps: + - name: 📂 setup + uses: actions/checkout@v2 + # include the lines below if you are using jekyll-last-modified-at + # or if you would otherwise need to fetch the full commit history + # however this may be very slow for large repositories! + # with: + # fetch-depth: '0' + + - name: 💎 setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 # can change this to 2.7 or whatever version you prefer + + - name: 🔨 install dependencies & build site + uses: limjh16/jekyll-action-ts@v2 + with: + enable_cache: true + ### Enables caching. Similar to https://github.com/actions/cache. + # + # format_output: true + ### Uses prettier https://prettier.io to format jekyll output HTML. + # + # prettier_opts: '{ "useTabs": true }' + ### Sets prettier options (in JSON) to format output HTML. For example, output tabs over spaces. + ### Possible options are outlined in https://prettier.io/docs/en/options.html + # + # prettier_ignore: 'about/*' + ### Ignore paths for prettier to not format those html files. + ### Useful if the file is exceptionally large, so formatting it takes a while. + ### Also useful if HTML compression is enabled for that file / formatting messes it up. + # + jekyll_src: docs + ### If the jekyll website source is not in root, specify the directory. (in this case, sample_site) + ### By default, this is not required as the action searches for a _config.yml automatically. + # + gem_src: docs + ### By default, this is not required as the action searches for a _config.yml automatically. + ### However, if there are multiple Gemfiles, the action may not be able to determine which to use. + ### In that case, specify the directory. (in this case, sample_site) + ### + ### If jekyll_src is set, the action would automatically choose the Gemfile in jekyll_src. + ### In that case this input may not be needed as well. + # + # key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + # restore-keys: ${{ runner.os }}-gems- + ### In cases where you want to specify the cache key, enable the above 2 inputs + ### Follows the format here https://github.com/actions/cache + # + # custom_opts: '--drafts --lsi' + ### If you need to specify any Jekyll build options, enable the above input + ### Flags accepted can be found here https://jekyllrb.com/docs/configuration/options/#build-command-options + + - name: 🚀 deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site + # if the repo you are deploying to is .github.io, uncomment the line below. + # if you are including the line below, make sure your source files are NOT in the master branch: + # publish_branch: master + diff --git a/docs/Gemfile b/docs/Gemfile index 36020b15..ec96435d 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -24,6 +24,7 @@ group :jekyll_plugins do gem 'jekyll-sitemap', '~>1.4.0' gem 'jemoji', '~>0.12.0' gem 'jekyll-relative-links', '~>0.6.1' + gem 'jekyll-minifier' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 70b66c60..3cdf8097 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -10,16 +10,19 @@ GEM public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) concurrent-ruby (1.1.9) + cssminify2 (2.0.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) + execjs (2.8.1) ffi (1.15.5) forwardable-extended (2.6.0) gemoji (3.0.1) html-pipeline (2.14.0) activesupport (>= 2) nokogiri (>= 1.4) + htmlcompressor (0.4.0) http_parser.rb (0.8.0) i18n (1.9.1) concurrent-ruby (~> 1.0) @@ -38,6 +41,12 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) + jekyll-minifier (0.1.10) + cssminify2 (~> 2.0) + htmlcompressor (~> 0.4) + jekyll (>= 3.5) + json-minify (~> 0.0.3) + uglifier (~> 4.1) jekyll-relative-links (0.6.1) jekyll (>= 3.3, < 5.0) jekyll-sass-converter (2.1.0) @@ -55,6 +64,9 @@ GEM gemoji (~> 3.0) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) + json (2.6.1) + json-minify (0.0.3) + json (> 0) kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) @@ -83,6 +95,8 @@ GEM unicode-display_width (~> 1.1, >= 1.1.1) tzinfo (2.0.4) concurrent-ruby (~> 1.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) unicode-display_width (1.8.0) PLATFORMS @@ -90,6 +104,7 @@ PLATFORMS DEPENDENCIES jekyll (~> 4.2.1) + jekyll-minifier jekyll-relative-links (~> 0.6.1) jekyll-seo-tag (~> 2.7.1) jekyll-sitemap (~> 1.4.0)