Build Docs PDF #49
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
name: Build Docs PDF | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version (e.g. ce_2.4.x - see 'app/_data/*.yml')" | |
required: true | |
env: | |
VITE_PORTAL_API_URL: ${{ vars.VITE_PORTAL_API_URL }} | |
jobs: | |
pdf: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
# Increase number of watchers to fix generation | |
- run: sudo sysctl -w fs.inotify.max_user_watches=524288 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# Configure Ruby to build Jekyll site | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
- name: Install foreman | |
run: gem install foreman | |
- name: Ruby gem cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Bundle Setup | |
run: bundle config path ${{ github.workspace }}/vendor/bundle | |
- name: Bundle Install | |
run: bundle install --jobs 4 --retry 3 | |
- name: Install foreman | |
run: gem install foreman | |
# Configure Node to build assets | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- run: npm ci | |
- name: Set date | |
run: | | |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
# Build the PDF | |
- name: Generate PDF for Docs "${{ github.event.inputs.version }}" | |
env: | |
KONG_DOC_VERSIONS: "${{ github.event.inputs.version }}" | |
run: | | |
npm install -g wait-on netlify-cli | |
netlify dev & wait-on http://localhost:8888 | |
cd pdf-generation | |
npm ci | |
node run.js | |
# Upload build PDFs | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "pdfs-${{ env.TODAY }}" | |
path: pdf-generation/pdfs/*.pdf |