Skip to content

Commit 90ba466

Browse files
Move V2 API docs to Github Pages (#3874)
* Replace v2 apidocs version widget app with a static-generated header on index.html * Note that the v2 docs will be deployed under capi-release's GitHub Pages via GitHub Actions
1 parent d2b619f commit 90ba466

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

.github/workflows/docs_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- uses: ./.github/workflows/composite/setup
3131
with:
3232
WORKING_DIRECTORY: docs/v3
33+
- name: Render V2 docs
34+
working-directory: docs/v2
35+
run: ./render.sh
3336
- name: Run docs tests
3437
run: |
3538
bundle config set --local without 'development'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ test.out
2828
!/.devcontainer/**/*
2929

3030
#DOCS
31+
docs/v2/index.html
3132

3233
docs/v3/*.gem
3334
docs/v3/*.rbc

docs/v2/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Cloud Foundry v2 API Docs
22
=========================
33

4-
To render these docs locally, run `python3 -m http.server 8000` and view at
5-
`localhost:8000`.
4+
To render these docs locally, run:
5+
```
6+
./render.sh
7+
python3 -m http.server 8000
8+
```
9+
10+
The docs can then be viewed at `localhost:8000`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@
3535
</head>
3636
<body>
3737
<div class="container">
38+
<div class="panel panel-info">
39+
<div class="panel-heading">
40+
<h3 class="panel-title">Version Note:</h3>
41+
</div>
42+
<div class="panel-body">
43+
These docs were last changed with
44+
<a href="https://github.com/cloudfoundry/cloud_controller_ng/commit/<%= ENV['DOC_CHANGE_COMMIT'] %>" class="alert-link"><%= ENV['DOC_CHANGE_COMMIT'] %></a>
45+
, and therefore they are up-to-date for CAPI version <%= ENV['DOC_CHANGE_VERSION'] %>.
46+
The V2 API is considered stable, and further changes are not expected.
47+
For previous versions, see the <code>docs/v2</code> directory at
48+
<a href="https://github.com/cloudfoundry/cloud_controller_ng/commits/main/config/version_v2" class="alert-link">the desired version</a>
49+
</div>
50+
</div>
51+
3852
<h1>Cloud Foundry API</h1>
3953

4054
<div class="article">

docs/v2/render.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
repo_root="$(git rev-parse --show-toplevel)"
5+
6+
pushd "$repo_root"
7+
export DOC_CHANGE_COMMIT="$(git log -1 --format=format:%h -- docs/v2)"
8+
git checkout $DOC_CHANGE_COMMIT -- config/version_v2
9+
export DOC_CHANGE_VERSION="$(cat config/version_v2)"
10+
git checkout -- config/version_v2
11+
popd
12+
13+
erb index.html.erb > index.html

0 commit comments

Comments
 (0)