Merge pull request #2919 from rpbouman/issue-2881-document-quantifier… #5
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 workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | |
name: Build and (optionally) deploy Jekyll site to Pages | |
on: [push, workflow_dispatch] | |
# 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-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
# Build job | |
build_html: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Get star count | |
env: | |
GH_TOKEN: ${{ secrets.GH_STAR_COUNT_TOKEN }} | |
run: | | |
STAR_COUNT=$(gh api repos/duckdb/duckdb | jq ".stargazers_count") | |
STAR_COUNT_FORMATTED=$(ruby -e 'printf("%.01fk", ARGV[0].to_i / 1000.0)' ${STAR_COUNT}) | |
echo "star_count: ${STAR_COUNT} (${STAR_COUNT_FORMATTED})" | |
echo "star_count: \"${STAR_COUNT_FORMATTED}\"" >> _config.yml | |
- name: Install Python requirements | |
run: pip install -r requirements.txt | |
- name: Fetch release calendar | |
run: python scripts/get_calendar.py | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
if: github.repository == 'duckdb/duckdb-web' | |
- name: Build with Jekyll | |
# Outputs to the './_site' directory by default | |
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
env: | |
JEKYLL_ENV: production | |
- name: Upload HTML artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html_artifact | |
path: _site | |
build_pdf: | |
runs-on: ubuntu-latest | |
container: | |
image: docker://pandoc/extra:3.1.1.0 | |
options: --entrypoint=sh | |
defaults: | |
run: | |
working-directory: single-file-document | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
run: | | |
PYTHONUNBUFFERED=1 | |
apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python | |
python3 -m ensurepip | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
- name: Concatenate files | |
run: python3 concatenate_to_single_file.py | |
- name: Convert with pandoc | |
run: pandoc --defaults pandoc-configuration.yaml | |
- name: Move artifact | |
run: | | |
mkdir -p ../_pdf | |
mv duckdb-docs.pdf ../_pdf | |
- name: Upload PDF artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pdf_artifact | |
path: _pdf | |
package_into_a_single_artifact: | |
runs-on: ubuntu-latest | |
needs: [build_html, build_pdf] | |
steps: | |
# download both the html and the pdf artifacts into the _site directory | |
- uses: actions/download-artifact@v4 | |
with: | |
name: html_artifact | |
path: _site | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pdf_artifact | |
path: _site | |
- name: Upload artifact for GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
if: github.ref == 'refs/heads/main' && github.repository == 'duckdb/duckdb-web' | |
runs-on: ubuntu-latest | |
needs: package_into_a_single_artifact | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
timeout: 3600000 | |
LinkChecker: | |
name: Link Checker | |
runs-on: ubuntu-latest | |
needs: deploy | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- run: pip install linkchecker --user | |
- name: Link Checker on stable | |
run: | | |
linkchecker https://duckdb.org/ --ignore-url 'https?://duckdb\.org/docs/archive/.*' --config .github/linkchecker/linkchecker.conf --file-output html/utf-8/report.html | |
echo $? | |
- run: cat report.html >> ${GITHUB_STEP_SUMMARY} | |
if: always() | |
- name: Link Checker on everything | |
run: linkchecker https://duckdb.org/ --config .github/linkchecker/linkchecker.conf --file-output html/utf-8/report.html | |
- run: cat report.html >> ${GITHUB_STEP_SUMMARY} | |
if: success() || failure() |