Skip to content

chore(deps): update ruby/setup-ruby action to v1.191.0 #2593

chore(deps): update ruby/setup-ruby action to v1.191.0

chore(deps): update ruby/setup-ruby action to v1.191.0 #2593

name: gh-pages-build
on:
workflow_dispatch:
inputs:
skip_link_checker:
description: "Skip Link Checker"
type: boolean
required: false
default: false
push:
branches-ignore:
- renovate/**
permissions: read-all
jobs:
gh-pages-build:
runs-on: ubuntu-latest
permissions:
contents: write
deployments: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: true
- name: Set Variables
id: variables
run: |
set -euo pipefail
CLOUDFLARE_PAGES_PROJECT=$(echo "${GITHUB_REPOSITORY#*/}" | tr . - )
if [[ "${GITHUB_REF_NAME}" = "main" ]]; then
BASE_DOMAIN="${GITHUB_REPOSITORY#*/}"
else
BASE_DOMAIN="${CLOUDFLARE_PAGES_PROJECT}.pages.dev"
fi
echo "BASE_DOMAIN=${BASE_DOMAIN}" | tee -a "${GITHUB_OUTPUT}"
echo "CLOUDFLARE_PAGES_PROJECT=${CLOUDFLARE_PAGES_PROJECT}" | tee -a "${GITHUB_OUTPUT}"
sed -i "s@^url: \"https://ruzickap.github.io\"@url: \"https://${BASE_DOMAIN}\"@" _config.yml
mkdir public
- name: Setup Ruby
uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
with:
ruby-version: 3.2
bundler-cache: true
- name: Build site
run: bundle exec jekyll build --destination public
env:
JEKYLL_ENV: "production"
- name: Add files to public directory
run: |
cp LICENSE public/
sed -n '1,/Dev Page:/p' README.md > public/README.md
touch public/.nojekyll
# echo 'google-site-verification: googleaa2cf0133141f1f4.html' > public/googleaa2cf0133141f1f4.html
# # https://www.bing.com/indexnow
# echo '0771af676e2543c3bd6577f3203aa839' > public/0771af676e2543c3bd6577f3203aa839.txt # DevSkim: ignore DS173237
# echo -e '<?xml version="1.0"?>\n<users>\n\t<user>592AB158E3F9EF887F8DC8E69A2FF754</user>\n</users>' > public/BingSiteAuth.xml
- name: Test site
run: |
bundle exec htmlproofer public \
--disable-external \
--ignore-urls "/^http://127.0.0.1/,/^http://0.0.0.0/,/^http://localhost/"
- name: Check broken links
uses: ruzickap/action-my-broken-link-checker@6c356a0c80f7f0a2a12f105850ef8efd24c6da63 # v2.7.0
with:
url: https://${{ steps.variables.outputs.BASE_DOMAIN }}
pages_path: public
cmd_params: '--exclude=(linkedin.com|twitter.com|fonts.gstatic.com|fonts.googleapis.com|${{ steps.variables.outputs.BASE_DOMAIN }}/projects/|mylabs.dev|www.googletagmanager.com|hub.docker.com|stackoverflow.com) --buffer-size=8192 --max-connections-per-host=5 --color=always --rate-limit=5 --header="User-Agent:Mozilla" --skip-tls-verification --timeout=20'
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true
- name: Web Page
run: |
cat << EOF | tee -a "${GITHUB_STEP_SUMMARY}"
* :low_brightness: <https://${{ steps.variables.outputs.BASE_DOMAIN }}>
EOF
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1.5.0
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/gh-pages' }}
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
branch: main
directory: ./public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: ${{ steps.variables.outputs.CLOUDFLARE_PAGES_PROJECT }}
wranglerVersion: 3
- name: Restore lychee cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Link Checker
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1.10.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: "--cache --max-cache-age 1d https://${{ steps.variables.outputs.BASE_DOMAIN }}"
fail: ${{ inputs.skip_link_checker && 'false' || 'true' }}