-
Notifications
You must be signed in to change notification settings - Fork 327
174 lines (159 loc) · 6.04 KB
/
jekyll.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# 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-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3' # 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
# add the update time to the index page of the documentation.
CURRENT_TIME=$(date +"%Y-%m-%d %H:%M:%S")
sed -i "s/You can also /This documentation was last updated at ${CURRENT_TIME}.\n\nYou can also /" docs/index.md
- name: Install Python requirements
run: pip install -r requirements.txt --break-system-packages
- name: Install zip
uses: montudor/action-zip@v1
- 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: Publish past releases CSV file
run: |
cp _data/past_releases.csv data/duckdb-releases.csv
- 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: Zip offline package
run: |
# create a copy of the _site directory for the offline package
cp -r _site duckdb-docs
echo "To browse the DuckDB website locally, run \`python -m http.server\` in this directory and connect to http://localhost:8000/" > duckdb-docs/README.md
# replace the necessary strings to ensure everything works properly after offline deployment.
python scripts/offline_docs_replace.py
# cleanup some directories, including the old (archive) pages
rm -rf scripts single-file-document duckdb-docs/docs/archive
# create archive
zip -qq -r duckdb-docs.zip duckdb-docs
# place the zip into the site
mv duckdb-docs.zip _site
- name: Upload site artifacts and zip archive
uses: actions/upload-artifact@v4
with:
name: html_artifact
path: _site
build_pdf:
runs-on: ubuntu-24.04
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-24.04
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-24.04
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-24.04
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()