add github actions
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
name: Deploy Docs & API Documentation
|
||||
|
||||
|
||||
on:
|
||||
# Trigger the workflow every time you push to the `gh-pages` branch
|
||||
# Using a different branch name? Replace `gh-pages` with your branch’s name
|
||||
push:
|
||||
branches: [ gh-pages ]
|
||||
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to use'
|
||||
required: true
|
||||
default: 'gh-pages'
|
||||
# Allow this job to clone the repo and create a page deployment
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout your repository using git
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install yq for OpenAPI generation
|
||||
run: |
|
||||
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
|
||||
chmod +x /usr/local/bin/yq
|
||||
|
||||
- name: Generate Swagger UI for all tags
|
||||
run: |
|
||||
chmod +x scripts/generate_all_openapi.sh
|
||||
./scripts/generate_all_openapi.sh
|
||||
|
||||
- name: Generate Swagger UI links for all versions
|
||||
run: ./scripts/generate_swagger_links.sh
|
||||
|
||||
- name: List Swagger UI build output
|
||||
run: ls -alR docs/public/swagger-ui/ || echo "No Swagger UI build output found"
|
||||
|
||||
- name: Check generated Swagger UI links file
|
||||
run: |
|
||||
if [ -f docs/src/content/docs/guides/using_apis.md ]; then
|
||||
head -20 docs/src/content/docs/guides/using_apis.md
|
||||
else
|
||||
echo "File not found: docs/src/content/docs/guides/using_apis.md"
|
||||
fi
|
||||
|
||||
- name: Install, build, and upload your site
|
||||
env:
|
||||
SITE_URL: ${{ env.SITE_URL }}
|
||||
BASE: ${{ github.event.repository.name }}
|
||||
uses: withastro/action@v4
|
||||
with:
|
||||
path: docs/ # The root location of your Astro project inside the repository. (optional)
|
||||
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
|
||||
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
|
||||
- name: Print Astro site configuration
|
||||
run: |
|
||||
echo "Astro Configuration:"
|
||||
cat ./docs/astro.config.mjs
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
Reference in New Issue
Block a user