Skip to content

Commit

Permalink
ci: publish docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Feb 6, 2024
1 parent 8731b17 commit c564787
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Create a docs directory
run: mkdir ./docs

- name: Save OpenAPI schema
run: poetry run python manage.py spectacular --file ./openapi-${GITHUB_SHA}.yml

Expand All @@ -63,7 +66,31 @@ jobs:
with:
name: openapi-schemas
path: |
./openapi-*.yml
openapi-*.yml
- name: Move and rename OpenAPI schema file to omit the SHA
run: mv openapi-${GITHUB_SHA}.yml prophecies/static/docs/openapi.yml

- name: Upload docs directory to github-pages artifacts
uses: actions/upload-pages-artifact@v2
with:
name: github-pages
path: prophecies/static/docs/

docs-publish:
runs-on: ubuntu-latest
needs: [build]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy artifact from "github-pages" to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4


package-publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v')
Expand Down
38 changes: 38 additions & 0 deletions prophecies/static/docs/api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Prophecies API</title>
<link rel="preconnect" href="https://unpkg.com">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap" rel="stylesheet">
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<style>
:root {
--font-ui: Poppins, "Poppins", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-prose: var(--font-ui);
--font-mono: "SF Mono",ui-monospace,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
--font-code: var(--font-mono);

--color-canvas-100: #E9EFEE;
--color-canvas-200: #fff;
--color-primary-tint: #98BFBE;

--color-primary: #235B59;
--color-success: #73B782;
--color-danger: #FE6565;
--color-warning: #e49c00;
}

:root .sl-inverted, [data-theme="light"] .sl-inverted, [data-theme="light"] .sl-inverted .sl-inverted .sl-inverted {
--color-canvas: #142b2a;
}
</style>
</head>
<body>
<elements-api apiDescriptionUrl="./openapi.yml" router="hash" layout="responsive" hideTryIt="true" />
</body>
</html>

0 comments on commit c564787

Please sign in to comment.