Skip to content

Build

Build #4295

Workflow file for this run

name: "Build"
on:
push:
branches:
- '**'
schedule:
# Customise: Cron interval
- cron: "0 3,7,11,15,19,23 * * *"
workflow_dispatch:
inputs:
regenerate:
description: Enter csv of recipe slugs to specifically regenerate
required: false
type: string
skip:
description: Enter csv of recipe slugs to specifically skip
required: false
type: string
verbose:
description: Run recipe in verbose mode
required: false
type: boolean
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.ref_name == github.event.repository.default_branch
# Customise: Total job run time limit
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
timeout-minutes: 1
with:
submodules: true
fetch-depth: 1
- name: Setup node
uses: actions/setup-node@v3
timeout-minutes: 1
with:
node-version: 'lts/*'
- name: Install npm dependencies
timeout-minutes: 1
run: |
npm install --no-fund
- uses: actions/setup-python@v4
timeout-minutes: 1
with:
python-version: '3.10'
- name: Install python requirements
timeout-minutes: 1
run: python -m pip install -r requirements.txt --upgrade
- name: Install calibre's and other dependencies
timeout-minutes: 1
run: sudo apt-fast update -y && sudo apt-fast install --no-install-recommends -y libegl1 libopengl0 imagemagick
- name: Get latest calibre version
id: calibrelatest
run: |
tag="$(curl -L --retry 3 --silent --fail 'https://api.github.com/repos/kovidgoyal/calibre/releases/latest' | jq -r .tag_name)" && \
echo "calibre_ver=${tag#*v}" && \
echo "calibre_ver=${tag#*v}" >> $GITHUB_ENV
- name: Get calibre binaries cache
id: cache-bin
uses: actions/cache@v3
timeout-minutes: 1
with:
path: cache/calibre
key: cache-calibre-x86_64-${{ env.calibre_ver }}
- name: Install calibre
timeout-minutes: 1
run: sh .github/workflows/install_calibre.sh
- name: Download meta artifacts
id: download-meta-artifact
uses: dawidd6/action-download-artifact@v2
timeout-minutes: 1
with:
name: meta-artifacts
path: meta
search_artifacts: true
if_no_artifact_found: warn
- name: Setup Pages
id: setup_pages
uses: actions/configure-pages@v3
timeout-minutes: 1
- name: Generate periodicals
env:
CI_PAGES_URL: ${{ steps.setup_pages.outputs.base_url }}
CALIBRE_CONFIG_DIRECTORY: ${{ github.workspace }}/calibre_config/
regenerate: ${{ github.event.inputs.regenerate }}
skip: ${{ github.event.inputs.skip }}
verbose: ${{ github.event.inputs.verbose }}
accounts: ${{ secrets.accounts }}
run: |
sh build.sh
if [[ -f 'job_summary.md' ]]; then cat 'job_summary.md' >> $GITHUB_STEP_SUMMARY; fi
echo -e "\n<"'!'"-- Commit ${GITHUB_SHA:0:7}, $(ebook-convert --version | head -n1) -->" >> public/index.html
rm -rf "$CALIBRE_CONFIG_DIRECTORY"
# Ref: https://github.com/actions/starter-workflows/blob/main/pages/static.yml
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
timeout-minutes: 2
- uses: actions/upload-artifact@v3
timeout-minutes: 1
with:
name: meta-artifacts
path: meta
if-no-files-found: warn