Skip to content

Commit cacd182

Browse files
authored
Clean up CI and add 2027 docs (#9)
1 parent d00a8be commit cacd182

File tree

2 files changed

+60
-40
lines changed

2 files changed

+60
-40
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Install API docs'
2+
description: 'Pull and install allwpilib API docs from a given git ref'
3+
inputs:
4+
ref:
5+
description: 'git ref to pull API docs from'
6+
required: true
7+
path:
8+
description: 'path to place API docs in'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Checkout docs
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ inputs.ref }}
17+
path: tmp/${{ inputs.ref }}
18+
- name: Finalize location
19+
shell: bash
20+
run: |
21+
rm -rf ${{ inputs.path }}/java ${{ inputs.path }}/cpp
22+
mkdir -p ${{ inputs.path }}
23+
mv tmp/${{ inputs.ref }}/javadoc ${{ inputs.path }}/java
24+
mv tmp/${{ inputs.ref }}/doxygen/html ${{ inputs.path }}/cpp
25+
rm -rf tmp

.github/workflows/static.yml

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,74 @@
22
name: Deploy static content to Pages
33

44
on:
5-
# Runs on pushes targeting the source branches
5+
# Runs on pushes targeting the main branch
66
push:
7-
branches: ["main", "allwpilib-development", "allwpilib-release", "allwpilib-beta"]
7+
branches: ["main"]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
1111

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13-
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
17-
1812
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1913
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2014
concurrency:
2115
group: "pages"
2216
cancel-in-progress: false
2317

2418
jobs:
25-
# Single deploy job since we're just deploying
26-
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
19+
assemble:
3020
runs-on: ubuntu-latest
3121
steps:
32-
- name: Checkout main
33-
uses: actions/checkout@v4
34-
with:
35-
ref: main
36-
- name: Checkout allwpilib-release
22+
- name: Checkout branch
3723
uses: actions/checkout@v4
24+
- name: Install release
25+
uses: ./.github/actions/install-docs
3826
with:
3927
ref: allwpilib-release
4028
path: allwpilib/docs/release
41-
- name: Checkout allwpilib-beta
42-
uses: actions/checkout@v4
29+
- name: Install beta
30+
uses: ./.github/actions/install-docs
4331
with:
4432
ref: allwpilib-beta
4533
path: allwpilib/docs/beta
46-
- name: Checkout allwpilib-development
47-
uses: actions/checkout@v4
34+
- name: Install development
35+
uses: ./.github/actions/install-docs
4836
with:
4937
ref: allwpilib-development
5038
path: allwpilib/docs/development
51-
- name: Finalize directory locations
52-
run: |
53-
rm -rf allwpilib/docs/release/java allwpilib/docs/release/cpp
54-
mv allwpilib/docs/release/javadoc allwpilib/docs/release/java
55-
mv allwpilib/docs/release/doxygen/html allwpilib/docs/release/cpp
56-
rm -rf allwpilib/docs/beta/java allwpilib/docs/beta/cpp
57-
mv allwpilib/docs/beta/javadoc allwpilib/docs/beta/java
58-
mv allwpilib/docs/beta/doxygen/html allwpilib/docs/beta/cpp
59-
rm -rf allwpilib/docs/development/java allwpilib/docs/development/cpp
60-
mv allwpilib/docs/development/javadoc allwpilib/docs/development/java
61-
mv allwpilib/docs/development/doxygen/html allwpilib/docs/development/cpp
39+
- name: Install 2027
40+
uses: ./.github/actions/install-docs
41+
with:
42+
ref: allwpilib-2027
43+
path: allwpilib/docs/2027
6244
- run: wget -O favicon.ico https://raw.githubusercontent.com/wpilibsuite/branding/main/export/ico/wpilib-icon-256.ico
63-
- name: Get pages url
64-
run: echo url=$(gh api "repos/${{ github.repository }}/pages" --jq '.html_url') >> $GITHUB_ENV
65-
env:
66-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Setup Pages
46+
id: configure-pages
47+
uses: actions/configure-pages@v5
48+
continue-on-error: ${{ github.repository != 'wpilibsuite/wpilibsuite.github.io'}}
6749
- name: Install sitemap generator
6850
run: npm install -g static-sitemap-cli@^2.2.5
51+
if: ${{ steps.configure-pages.outcome == 'success' }}
6952
- name: Generate sitemap
70-
run: static-sitemap-cli --base ${{ env.url }} --root . --ignore "allwpilib/docs/beta/**" "allwpilib/docs/development/**" --changefreq "**,monthly" "allwpilib/docs/**,weekly" --verbose --no-clean
71-
- name: Setup Pages
72-
uses: actions/configure-pages@v5
53+
run: static-sitemap-cli --base ${{ steps.configure-pages.outputs.base_url }} --root . --ignore "allwpilib/docs/beta/**" "allwpilib/docs/development/**" "allwpilib/docs/2027/**" --changefreq "**,monthly" "allwpilib/docs/**,weekly" --verbose --no-clean
54+
if: ${{ steps.configure-pages.outcome == 'success' }}
7355
- name: Upload artifact
7456
uses: actions/upload-pages-artifact@v3
7557
with:
7658
# Upload entire repository
7759
path: '.'
60+
61+
deploy:
62+
needs: assemble
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
67+
permissions:
68+
contents: read
69+
pages: write
70+
id-token: write
71+
runs-on: ubuntu-latest
72+
steps:
7873
- name: Deploy to GitHub Pages
7974
id: deployment
8075
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)