v0.17.0 #165
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Portal Content | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| release: | |
| types: [published] | |
| paths: | |
| - 'docs/**' | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Deployment environment: Production or Staging' | |
| required: false | |
| default: 'Staging' | |
| log_level: | |
| description: 'Log level: 1=DEBUG, 2=INFO, 3=WARNING, 4=ERROR' | |
| required: false | |
| default: '2' # Set the default log level to INFO | |
| permissions: read-all | |
| env: | |
| LOG_LEVEL: ${{ github.event.inputs.log_level }} | |
| jobs: | |
| spell-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '20' | |
| - name: Run cspell | |
| run: npx -y cspell --config ./.cspell.json "./docs/**/*.md" | |
| validate-manifests: | |
| runs-on: ubuntu-latest | |
| needs: spell-check | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '20' | |
| - name: Validate manifests | |
| run: | | |
| . ./docs/scripts/utilities.sh | |
| for product in ./docs/products/*; do | |
| if [[ -d "$product" ]]; then | |
| product_name=${product#./docs/products/} | |
| manifest="./docs/products/$product_name/manifest.json" | |
| if [[ -f "$manifest" ]]; then | |
| # Further actions... | |
| log_message $INFO "Validating manifest in product: $product_name" | |
| log_message $DEBUG "Validating manifest: $manifest" | |
| npx -y ajv-cli validate -s ./docs/schemas/manifest.schema.json -d "$manifest" --spec=draft2020 | |
| fi | |
| fi | |
| done | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.event_name == 'release' && 'Production' || github.event.inputs.environment || 'Staging' }} | |
| needs: [spell-check, validate-manifests] | |
| if: github.event.inputs.skip_api_linting == 'true' || (needs.spell-check.result == 'success' && needs['validate-manifests'].result == 'success') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Publish docs to Portal | |
| shell: bash | |
| run: | | |
| for product in ./docs/products/*; do | |
| echo "Product: $product" | |
| if [[ -d "$product" ]]; then | |
| echo "Product is a directory" | |
| product_name=${product#./docs/products/} | |
| echo "Product name: $product_name" | |
| manifest="./docs/products/$product_name/manifest.json" | |
| echo "Manifest: $manifest" | |
| if [[ -f "$manifest" ]]; then | |
| echo "Manifest is a file" | |
| . ./docs/scripts/publish-portal-content.sh && portal_product_upsert "$manifest" "$product_name" | |
| . ./docs/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 }} | |
| SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }} |