Skip to content

Commit 3a87379

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Create GitHub Actions workflow for deploying docs.
This allows+requires us to [replace each release's Javadoc directory with a Javadoc archive file](407e30a). As noted in that commit, this saves a ton of time when switching branches: I'm now seeing ~3s instead of ~30s to switch to `gh-pages` and ~2s instead of ~7s to switch back to `master`. (It probably slows down downloading the entire repo's history, though, since the repo history now contains all the original files *plus* the archives that contain them all. I can fix that if I ever rewrite the whole history of `gh-pages`.) I'd raised this possibility back in #7597 (comment). To make this take effect, I'll need to update https://github.com/google/guava/settings/pages to use a Source of "GitHub Actions" instead of "Deploy from a branch." This matches what we already do for JSpecify. I notice that it may be a little weird for our `master` branch to have a GitHub Actions setup that pushes to our `gh-pages` branch, which then has a GitHub Actions setup that deploys that branch. I suspect that it at least makes sense to have two separate actions, since we sometimes push to the `gh-pages` branch outside the context of a push to `main`—notably, when we perform a release. (One thing that we could consider is the idea of merging `gh-pages` into `master`, presumably under a `docs` directory. But I think that's been possible forever, and we haven't done it. That's probably for the best, since it would make a shallow clone of `master` slow because of all the Javadoc.) RELNOTES=n/a PiperOrigin-RevId: 851409347
1 parent 1a143d3 commit 3a87379

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches:
6+
- gh-pages
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
16+
jobs:
17+
build:
18+
name: Build GitHub Pages site
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
23+
24+
- name: Extract Javadoc archives
25+
working-directory: releases
26+
run: |
27+
for file in *.tar.gz; do
28+
tar -xzf "$file"
29+
rm "$file"
30+
done
31+
32+
- name: Setup Pages
33+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
34+
35+
- name: Build with Jekyll
36+
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697
37+
with:
38+
source: ./
39+
destination: ./_site
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
43+
with:
44+
path: ./_site
45+
46+
deploy:
47+
name: Deploy to GitHub Pages
48+
needs: build
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

0 commit comments

Comments
 (0)