mirror of
https://github.com/loot/loot.github.io.git
synced 2026-07-27 14:13:30 -07:00
It's currently easy to hit the GitHub API's rate limit just by refreshing the credits page a couple of times. The data doesn't change that frequently, so instead fetch it into a JSON file as part of the build process, have Hugo generate the page using the JSON file and a template, and deploy the site each day at midnight so that the live data is at most 24 hours old.
88 lines
2.0 KiB
YAML
88 lines
2.0 KiB
YAML
name: Continuous Deployment
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
schedule:
|
|
- cron: 0 0 * * *
|
|
workflow_dispatch:
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
# 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
|
|
|
|
# Default to bash
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
# Build job
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
|
|
env:
|
|
HUGO_VERSION: 0.154.4
|
|
|
|
steps:
|
|
- name: Install Hugo CLI
|
|
run: |
|
|
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
|
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Pages
|
|
id: pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Install Node.js dependencies
|
|
run: npm ci
|
|
|
|
- name: Fetch contributors data
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: node generate_contributors_json.js
|
|
|
|
- name: Build with Hugo
|
|
env:
|
|
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
|
|
HUGO_ENVIRONMENT: production
|
|
run: |
|
|
hugo \
|
|
--minify \
|
|
--baseURL "${{ steps.pages.outputs.base_url }}/"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v4
|
|
with:
|
|
path: ./public
|
|
|
|
# Deployment job
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
runs-on: ubuntu-24.04
|
|
|
|
needs: build
|
|
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|