Skip to content

Update TWiStErRob/github-workflows digest to f44f69e #19

Update TWiStErRob/github-workflows digest to f44f69e

Update TWiStErRob/github-workflows digest to f44f69e #19

Workflow file for this run

name: "CI"
on:
push:
branches:
- main
pull_request:
types:
- opened # default
- reopened # default
- synchronize # default
- labeled # Listen for label changes to re-run the diff job.
- unlabeled # Listen for label changes to re-run the diff job.
workflow_dispatch:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
validate:
name: "🦺 Validation"
uses: TWiStErRob/github-workflows/.github/workflows/validate.yml@f44f69e4ba1bcbd6a7ecf29dba33342d23e3220c # v3
permissions:
contents: read
security-events: write
actions: read
build:
name: "Build GitHub Pages Site"
timeout-minutes: 5
permissions:
# actions/checkout
contents: read
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4
with:
submodules: true
- name: "Setup old Ruby."
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.8'
bundler-cache: false
cache-version: 0 # Increment this number if you need to re-download cached gems.
- name: "Install fontcustom with all dependencies."
working-directory: sources/iconfont
run: "${GITHUB_WORKSPACE}/.github/workflows/install-fontcustom.sh"
- name: "Build iconfont."
working-directory: sources/iconfont
run: fontcustom compile
- name: "Upload 'iconfont' artifact."
uses: actions/upload-artifact@v4
with:
name: 'iconfont'
if-no-files-found: error
path: |
_sass/_iconfont.scss
assets/fonts/iconfont.eot
assets/fonts/iconfont.svg
assets/fonts/iconfont.ttf
assets/fonts/iconfont.woff
assets/fonts/iconfont.woff2
sources/iconfont/.fontcustom-manifest.json
sources/iconfont/iconfont-preview.html
- name: "Setup Ruby."
uses: ruby/setup-ruby@v1
with:
#ruby-version: .ruby-version # So checkout is needed.
bundler-cache: true
cache-version: 0 # Increment this number if you need to re-download cached gems.
- name: "Retrieve GitHub Pages configuration."
id: pages
uses: actions/configure-pages@v5
- name: "Build _site with Jekyll."
env:
JEKYLL_ENV: production
BASE_URL: "${{ steps.pages.outputs.base_path }}"
run: bundle exec jekyll build --trace --baseurl "${BASE_URL}"
- name: "Upload 'github-pages' artifact."
uses: actions/upload-pages-artifact@v3
with:
path: _site/
deploy:
name: "Deploy GitHub Pages Site"
if: ${{ github.event_name == 'push' }}
needs:
- build
timeout-minutes: 1
permissions:
# actions/deploy-pages
pages: write
# actions/deploy-pages
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4
cache:
name: "Build Reference Site"
if: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'content-change')) || github.event_name == 'push' }}
timeout-minutes: 5
permissions:
# actions/checkout
contents: read
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: "Calculate relevant SHA."
id: params
env:
SHA: ${{ github.event.pull_request.base.sha || github.event.after }}
run: |
echo "sha=${SHA}" >> "${GITHUB_OUTPUT}"
- name: "Load cached site."
id: cache
uses: actions/cache/restore@v4
with:
key: github-pages-${{ steps.params.outputs.sha }}
path: _site/
# If exists (steps.cache.outputs.cache-hit == 'true'), then skip regeneration steps.
- name: "Checkout ${{ steps.params.outputs.sha }} commit in ${{ github.repository }} repository."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ steps.params.outputs.sha }}
- name: "Setup old Ruby."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.8'
bundler-cache: false
cache-version: 0 # Increment this number if you need to re-download cached gems.
- name: "Install fontcustom with all dependencies."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
working-directory: sources/iconfont
run: "${GITHUB_WORKSPACE}/.github/workflows/install-fontcustom.sh"
- name: "Build iconfont."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
working-directory: sources/iconfont
run: fontcustom compile
- name: "Setup Ruby."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: ruby/setup-ruby@v1
with:
#ruby-version: .ruby-version # So checkout is needed.
bundler-cache: true
cache-version: 0 # Increment this number if you need to re-download cached gems.
- name: "Retrieve GitHub Pages configuration."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
id: pages
uses: actions/configure-pages@v5
- name: "Build _site with Jekyll."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
env:
JEKYLL_ENV: production
BASE_URL: "${{ steps.pages.outputs.base_path }}"
run: bundle exec jekyll build --trace --baseurl "${BASE_URL}"
- name: "Upload 'github-pages-base' artifact."
if: ${{ github.event_name == 'pull_request' && (success() || failure()) }}
# Move cached files from cache to artifacts, so they can be used in other jobs.
# It seems the job id/context is used to create the "cache version" and it always mismatches.
#if: steps.cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: 'github-pages-base'
if-no-files-found: error
path: _site/
- name: "Store _site to cache."
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
key: ${{ steps.cache.outputs.cache-primary-key }}
path: _site/
diff:
name: "Verify Against Reference Site"
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'content-change') }}
needs:
- build
- cache
timeout-minutes: 1
permissions: {} # download-artifact doesn't need a permission.
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: "Download base reference."
uses: actions/download-artifact@v4
with:
name: 'github-pages-base'
path: github-pages-base
- name: "Prepare base for diffing."
working-directory: github-pages-base
run: |
rm assets/fonts/iconfont.eot
rm assets/fonts/iconfont.svg
rm assets/fonts/iconfont.ttf
rm assets/fonts/iconfont.woff
rm assets/fonts/iconfont.woff2
sed -re 's/Last Updated: [0-9]{4}\/[0-9]{2}\/[0-9]{2}//' -i humans.txt
- name: "Download just-built artifact."
uses: actions/download-artifact@v4
with:
name: 'github-pages'
path: github-pages-head
- name: "Prepare head for diffing."
working-directory: github-pages-head
run: |
# This is not a normal artifact. It was produced by actions/upload-pages-artifact and has only a tar file inside.
tar -xf artifact.tar && rm artifact.tar
rm assets/fonts/iconfont.eot
rm assets/fonts/iconfont.svg
rm assets/fonts/iconfont.ttf
rm assets/fonts/iconfont.woff
rm assets/fonts/iconfont.woff2
sed -re 's/Last Updated: [0-9]{4}\/[0-9]{2}\/[0-9]{2}//' -i humans.txt
# assets/fonts/ is excluded, because building fonts is not deterministic.
- name: "Diff head against base."
run: diff --recursive github-pages-base github-pages-head