mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-05-18 13:24:15 +00:00
feat: deploy pages with CI
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
881e9203c1
commit
6e1698e820
37
.github/workflows/deploy-pages.yml
vendored
Normal file
37
.github/workflows/deploy-pages.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: Deploy API Docs to GitHub Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: pages
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v6
|
||||||
|
|
||||||
|
- name: Build static documentation bundle
|
||||||
|
run: src/docs/build-static-bundle.sh site "${{ github.event.release.tag_name }}"
|
||||||
|
|
||||||
|
- name: Upload Pages artifact
|
||||||
|
uses: actions/upload-pages-artifact@v5
|
||||||
|
with:
|
||||||
|
path: site
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v5
|
||||||
24
src/docs/build-static-bundle.sh
Executable file
24
src/docs/build-static-bundle.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
DOCS_DIR="$ROOT_DIR/src/docs"
|
||||||
|
INDEX_FILE="$DOCS_DIR/index.html"
|
||||||
|
OUT_DIR="${1:?output directory argument is required}"
|
||||||
|
DOCS_VERSION="${2:?docs version argument is required}"
|
||||||
|
NORMALIZED_DOCS_VERSION="${DOCS_VERSION#v}"
|
||||||
|
|
||||||
|
echo "Normalized docs version: $NORMALIZED_DOCS_VERSION"
|
||||||
|
|
||||||
|
rm -rf "$OUT_DIR"
|
||||||
|
mkdir -p "$OUT_DIR"
|
||||||
|
|
||||||
|
cp "$DOCS_DIR/swagger.json" "$OUT_DIR/swagger.json"
|
||||||
|
cp "$INDEX_FILE" "$OUT_DIR/index.html"
|
||||||
|
touch "$OUT_DIR/.nojekyll"
|
||||||
|
|
||||||
|
jq --arg version "$NORMALIZED_DOCS_VERSION" '.info.version = $version' "$OUT_DIR/swagger.json" > "$OUT_DIR/swagger.json.tmp"
|
||||||
|
mv "$OUT_DIR/swagger.json.tmp" "$OUT_DIR/swagger.json"
|
||||||
|
|
||||||
|
echo "Static bundle created at: $OUT_DIR"
|
||||||
@ -11,7 +11,7 @@
|
|||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
// Begin Swagger UI call region
|
// Begin Swagger UI call region
|
||||||
const ui = SwaggerUIBundle({
|
const ui = SwaggerUIBundle({
|
||||||
url: "src/docs/swagger.json", //Location of Open API spec in the repo
|
url: "swagger.json",
|
||||||
dom_id: '#swagger-ui',
|
dom_id: '#swagger-ui',
|
||||||
deepLinking: true,
|
deepLinking: true,
|
||||||
presets: [
|
presets: [
|
||||||
Loading…
x
Reference in New Issue
Block a user