Skip to content

Commit

Permalink
Add render step to v2 index.html, to populate version info header
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotalgeorge authored and walrusfruitcake committed Jul 5, 2024
1 parent ccb08a4 commit fcb10f3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/gh_pages_docs_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ jobs:
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: debug path
working-directory: docs/v2
run: |
pwd
ls
./render.sh
ls
- name: Render index template
working-directory: docs/v2
run: docs/v2/render.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test.out
!/.devcontainer/**/*

#DOCS
docs/v2/index.html

docs/v3/*.gem
docs/v3/*.rbc
Expand Down
7 changes: 6 additions & 1 deletion docs/v2/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Cloud Foundry v2 API Docs
=========================

To render these docs locally, run `python3 -m http.server 8000` and view at
To render these docs locally, run:
```
./render.sh
python3 -m http.server 8000
```
the docs can then be viewed at
`localhost:8000`.
6 changes: 4 additions & 2 deletions docs/v2/index.html → docs/v2/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
<h3 class="panel-title">Version Note:</h3>
</div>
<div class="panel-body">
These docs were last changed with [commit], and therefore these docs are up-to-date for CAPI version [version].
These docs were last changed with
<a href="https://github.com/cloudfoundry/cloud_controller_ng/commit/<%= ENV['DOC_CHANGE_COMMIT'] %>" class="alert-link"><%= ENV['DOC_CHANGE_COMMIT'] %></a>
, and therefore they are up-to-date for CAPI version <%= ENV['DOC_CHANGE_VERSION'] %>.
The V2 API is considered stable, and further changes are not expected.
For previous versions, see the [docs/v2] directory at
For previous versions, see the <code>docs/v2</code> directory at
<a href="https://github.com/cloudfoundry/cloud_controller_ng/commits/main/config/version_v2" class="alert-link">the desired version</a>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions docs/v2/render.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"

pushd "$repo_root"
export DOC_CHANGE_COMMIT="$(git log -1 --format=format:%h -- docs/v2)"
git checkout $DOC_CHANGE_COMMIT -- config/version_v2
export DOC_CHANGE_VERSION="$(cat config/version_v2)"
git checkout -- config/version_v2
popd

erb index.html.erb > index.html

0 comments on commit fcb10f3

Please sign in to comment.