Skip to content

Portal-Docs-Publish #14

Portal-Docs-Publish

Portal-Docs-Publish #14

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
environment:
description: 'Environment to deploy to (e.g., smartbearcoin or frankkilcommins)'
required: true
default: 'smartbearcoin' # Set a default environment
env:
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
target_env: ${{ github.event.inputs.environment }}
jobs:
publish-to-portal:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Iterate over product folders and publish content to the portal
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
- name: Republish for images etc.
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 }}