Skip to content

Portal-Docs-Publish

Portal-Docs-Publish #7

name: Portal-Docs-Publish
on:
workflow_dispatch:
inputs:
log_level:
description: 'Log level: 1=DEBUG, 2=INFO, 3=WARNING, 4=ERROR'
required: false
default: '2' # Set the default log level to INFO
env:
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
jobs:
publish-to-portal:
runs-on: ubuntu-latest
environment: prd
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Iterate over product folders
shell: bash
run: |
for product in ./products/*; do
echo "Product: $product"
if [[ -d "$product" ]]; then
echo "Product is a directory"
product_name=${product#./products/}
echo "Product name: $product_name"
manifest="./products/$product_name/manifest.json"
echo "Manifest: $manifest"
if [[ -f "$manifest" ]]; then
echo "Manifest is a file"
. ./scripts/publish-portal-content.sh && portal_product_upsert "$manifest" "$product_name"
. ./scripts/publish-portal-content.sh && load_and_process_product_manifest_content_metadata "$manifest" "$product_name"
else
echo "Manifest is not a file"
fi
else
echo "Product is not a directory"
fi
done
env:
SWAGGERHUB_PORTAL_SUBDOMAIN: ${{ vars.SWAGGERHUB_PORTAL_SUBDOMAIN }}