Skip to content

Commit 89bf42d

Browse files
hopkincameanother-rexLy-Joey
authored
feat: Move away from github-pages gem and add ruby 4 support for docs (#2588)
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 docs 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. --------- Co-authored-by: Rex P <106129829+another-rex@users.noreply.github.com> Co-authored-by: Joey L <joeylauy@google.com>
1 parent 0ee94bd commit 89bf42d

7 files changed

Lines changed: 133 additions & 215 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: [docs]
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@19a43a6a2428d455dbd1b85344698725179c9d8c # v1.289.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@983d7736d9b0ae728b81ab479565c72886d7745b # v5.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@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
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@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ Please follow these steps to successfully contribute documentation.
174174
3. Preview the changes by spinning up a GitHub page for your fork, building from your working branch.
175175
<!-- markdown-link-check-disable-next-line -->
176176
- On your fork, go to the settings tab and then the GitHub page settings. Sample URL: https://github.com/{your-github-profile}/osv-scanner/settings/pages
177-
- Under "Build and deployment" select "Deploy from a branch"
178-
- Set the branch to your working branch
179-
- Set the github page to build from the "/docs" folder
180-
- Hit save and wait for your site to build
177+
- Under "Build and deployment" select "Github Actions"
178+
- 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
179+
- Push your commit and wait for the pages to build
181180
- Once it is ready, click the link and preview the docs
181+
- If the pages were built successfully, remove your branch from the "docs-deploy.yml" workflow
182182

183183
![Image shows the UI settings for building the GitHub page, which is described in step 3 of the contributing documentation instructions.](docs/images/github-page.png)
184184

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", "~> 232", group: :jekyll_plugins
17-
# If you have any plugins, put them here!
18-
group :jekyll_plugins do
19-
gem "jekyll-feed", "~> 0.15"
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)