Skip to content

Commit 943f9e4

Browse files
authored
feat: move away from github-pages gem and add ruby 4 support for docs (google#5534)
Based off google/osv-scanner#2588 and google#4972 --- This PR reworks the doc page deployment by removing the github pages gem and deploying using a github actions workflow. This was done to enable support for ruby 4, which is unsupported by github pages. As a result of the docs being deployed by github actions rather than pages, the deployment process for docs has changed, this PR also has an update to the contribution docs to reflect these changes. The github action workflow is set to deploy docs when there is a push to the master branch. This PR also adds some plugins for Jekyll. These were ones that github pages added automatically, now that we have removed github pages, thee plugins are included here instead. Once this PR is merged, the "Pages" settings will need to be updated. The build and deployment source will need to be changed to github actions Closes google#4972 Closes google#5005
1 parent 29e2069 commit 943f9e4

6 files changed

Lines changed: 127 additions & 209 deletions

File tree

.github/workflows/docs-deploy.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Jekyll site to Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
11+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
12+
concurrency:
13+
group: "pages"
14+
cancel-in-progress: false
15+
16+
# Restrict jobs in this workflow to have no permissions by default; permissions
17+
# should be granted per job as needed using a dedicated `permissions` block
18+
permissions: {}
19+
20+
jobs:
21+
# Build job
22+
build:
23+
permissions:
24+
contents: read
25+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
26+
BUNDLE_GEMFILE: ${{ github.workspace }}/docs/Gemfile
27+
runs-on: ubuntu-latest
28+
defaults:
29+
run:
30+
working-directory: ./docs
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
- name: Setup Ruby
35+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
36+
with:
37+
ruby-version: "4" # Not needed with a .ruby-version file
38+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
39+
cache-version: 0 # Increment this number if you need to re-download cached gems
40+
- name: Setup Pages
41+
id: pages
42+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
43+
- name: Build with Jekyll
44+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
45+
env:
46+
JEKYLL_ENV: production
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
49+
with:
50+
path: ./docs/_site
51+
52+
# Deployment job
53+
deploy:
54+
permissions:
55+
contents: read
56+
pages: write
57+
id-token: write
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
runs-on: ubuntu-latest
62+
needs: build
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ Please follow these steps to successfully contribute documentation.
241241
Sample URL: <!-- markdown-link-check-disable -->
242242
https://github.com/{your-github-profile}/osv.dev/settings/pages
243243
<!-- markdown-link-check-enable -->
244-
- Under "Build and deployment" select "Build from branch"
245-
- Set the branch to your working branch
246-
- Set the github page to build from the "/docs" folder
247-
- Hit save and wait for your site to build
248-
- Once it is ready, click the link and preview the docs
244+
- Under "Build and deployment" select "Github Actions"
245+
- Add your working branch to the on push branches (line 5) in the "docs-deploy.yml" file, this can be found in the ".github/workflows" directory
246+
- Push your commit and wait for the pages to build
247+
- Once it is ready, click the link and preview the docs
248+
- If the pages were built successfully, remove your branch from the "docs-deploy.yml" workflow
249249

250250
![Image shows the UI settings for building the GitHub page, which is described
251251
in step 3 of the contributing documentation

docs/Gemfile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ruby "~> 3"
1+
ruby "~> 4"
22

33
source "https://rubygems.org"
44
# Hello! This is where you manage which Jekyll version is used to run.
@@ -9,15 +9,17 @@ source "https://rubygems.org"
99
#
1010
# This will help ensure the proper Jekyll version is running.
1111
# Happy Jekylling!
12-
# gem "jekyll", "~> 4.3.2"
13-
# This is the default theme for new Jekyll sites. You may change this to anything you like.
14-
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
15-
# uncomment the line below. To upgrade, run `bundle update github-pages`.
16-
gem "github-pages", group: :jekyll_plugins
17-
# If you have any plugins, put them here!
18-
group :jekyll_plugins do
19-
gem "jekyll-feed", "~> 0.12"
20-
end
12+
gem "jekyll", "~> 4.3.2"
13+
gem "csv"
14+
gem "base64"
15+
gem "jekyll-feed", "~> 0.15"
16+
gem "jekyll-relative-links"
17+
gem "jekyll-optional-front-matter"
18+
gem "jekyll-readme-index"
19+
gem "jekyll-default-layout"
20+
gem "jekyll-titles-from-headings"
21+
gem "just-the-docs"
22+
gem "jekyll-github-metadata"
2123

2224
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
2325
# and associated library.

0 commit comments

Comments
 (0)