Skip to content

Commit

Permalink
Use dynamic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrebert committed May 2, 2024
1 parent c716c0f commit 746d9e0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 6 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy Documentation

on:
push:
branches:
- "v1"
# - "v2" # Uncomment this line to deploy v2
paths-ignore:
- '.gitignore'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'

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

concurrency:
group: pages
cancel-in-progress: true

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:

deploy:
name: Deploy the documentation
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Prepare
run: mkdir _site
- name: Checkout v1
uses: actions/checkout@v4
with:
ref: v1
path: _site/v1
## Uncomment this block to deploy v2
# - name: Checkout v2
# uses: actions/checkout@v4
# with:
# ref: v2
# path: _site/v2
- name: Clean
run: rm -rf **/.git
- name: Redirect to the latest version
run: |
export latest=$(ls -1 _site | sort -r | head -n 1)
echo "<meta http-equiv='cache-control' content='no-cache, no-store, must-revalidate' />" > _site/index.html
echo "<meta http-equiv='refresh' content='0;url=${latest}/index.html'>" >> _site/index.html
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site/
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Swagger documentation for the tool APIs is available at [https://before-interop.
```yaml
responses:
'400':
$ref: https://raw.githubusercontent.com/before-interop/common/main/common/responses/errors.openapi.yaml#/components/responses/Error-400
$ref: https://raw.githubusercontent.com/before-interop/common/v1/common/responses/errors.openapi.yaml#/components/responses/Error-400
```
### Extend a component
Expand All @@ -23,7 +23,7 @@ components:
schemas:
MyObject:
allOf:
- $ref: https://raw.githubusercontent.com/before-interop/common/main/common/schemas/Entity.openapi.yaml#/components/schemas/Entity
- $ref: https://raw.githubusercontent.com/before-interop/common/v1/common/schemas/Entity.openapi.yaml#/components/schemas/Entity
properties:
myProperty:
type: string
Expand Down
8 changes: 4 additions & 4 deletions docs/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
urls: [
{
name: "TroubleTicket",
url: "https://raw.githubusercontent.com/before-interop/common/main/tools/trouble-ticket/trouble-ticket.openapi.yaml",
url: "./tools/trouble-ticket/trouble-ticket.openapi.yaml",
},
{
name: "Attachment",
url: "https://raw.githubusercontent.com/before-interop/common/main/tools/attachment/attachment.openapi.yaml",
url: "./tools/attachment/attachment.openapi.yaml",
},
{
name: "Note",
url: "https://raw.githubusercontent.com/before-interop/common/main/tools/note/note.openapi.yaml",
url: "./tools/note/note.openapi.yaml",
},
{
name: "Event",
url: "https://raw.githubusercontent.com/before-interop/common/main/tools/event/event.openapi.yaml",
url: "./tools/event/event.openapi.yaml",
},
],
dom_id: "#swagger-ui",
Expand Down

0 comments on commit 746d9e0

Please sign in to comment.