Skip to content

Feat/initial-automation (#8) #30

Feat/initial-automation (#8)

Feat/initial-automation (#8) #30

Workflow file for this run

name: Publish Portal Content
on:
push:
branches:
- main
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 }}
LOG_LEVEL: ${{ github.event.inputs.log_level }}
jobs:
publish:
runs-on: ubuntu-latest
environment: Production
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 }}