Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
- add api doc
- add workflow to gnerate html and publish to pages
  • Loading branch information
timschaeren committed Jul 17, 2024
0 parents commit 890e5f6
Show file tree
Hide file tree
Showing 2 changed files with 1,197 additions and 0 deletions.
66 changes: 66 additions & 0 deletions github/workflows/redocly_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Generate html from yml docs and publish to pages

on:
push:
branches:
- main

jobs:
generate_docs:
name: Generate HTML Docs
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Check for .yml files
run: |
if ls *.yml 1> /dev/null 2>&1; then
echo "YAML files found."
else
echo "No YAML files found. Exiting."
exit 1
fi
- name: Install Node.js
uses: actions/[email protected]

- name: Install Redocly CLI
run: npm install -g @redocly/cli

- name: Generate HTML files
run: |
for file in *.yml; do
redocly build-docs -o ${file%.*}.html $file
done
- name: Add noIndex Meta Tag
run: |
for file in *.html; do
if [[ -f "$file" ]]; then
echo "Found HTML file: $file"
if sed -i '/<head>/a <meta name="robots" content="noindex">' "$file"; then
echo "Added meta tag to $file successfully."
else
echo "Failed to add meta tag to $file."
fi
fi
done
shell: bash

- name: Set up Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: . # Root folder where HTML files are located
Loading

0 comments on commit 890e5f6

Please sign in to comment.