Auto pages deploy #21988
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Auto pages deploy | |
# Controls when the action will run. Triggers the workflow on push | |
# events but only for the main branch and on a schedule | |
on: | |
workflow_dispatch: # Allows manual triggering of the workflow | |
push: # Triggers the workflow on push events to the main branch | |
branches: [ main ] | |
schedule: # Triggers the workflow on a schedule (twice a day) | |
- cron: '0 3,15 * * *' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
pages-build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Caches the AI summary | |
- name: Cache AI summary | |
id: cache-ai-summary | |
uses: actions/cache@v4 | |
with: | |
path: cache | |
key: ai-summary | |
restore-keys: | | |
ai-summary | |
# Sets up Ruby environment | |
- name: Setup Ruby | |
uses: ruby/[email protected] | |
with: | |
ruby-version: '3.1.1' # Version range or exact version of a Ruby version to use, using semvers version range syntax. | |
bundler-cache: true | |
# Runs the Ruby script to render the page | |
- run: bundle exec ruby render.rb | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
# Prunes old summaries from the cache | |
- name: Prune old summaries | |
run: | | |
find cache -type f -name '*.json' -mtime +1 -delete | |
# Uploads the AI summary to the cache | |
- name: Upload AI summary to cache | |
uses: actions/cache@v4 | |
with: | |
path: cache | |
key: ai-summary | |
# Runs a Git AV scan | |
- name: Git AV Scan | |
if: success() | |
uses: djdefi/gitavscan@20 | |
# Checks the rendered HTML for issues | |
- name: Check Rendered HTML | |
if: success() | |
uses: chabad360/htmlproofer@master | |
continue-on-error: true | |
with: | |
directory: "./public" | |
arguments: "--disable-external" | |
# Deploys the site to GitHub Pages | |
- name: GitHub Pages | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
build_dir: public | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |