New OpEx Dashboard Reusable Workflow #714
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: Deploy DX Website to Azure | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "apps/website/**" # Trigger only when this app changes | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - main | |
| paths: | |
| - "apps/website/**" | |
| jobs: | |
| deploy_to_static_web_app: | |
| uses: pagopa/dx/.github/workflows/release-azure-staticapp-v1.yaml@main # Path to the reusable workflow | |
| secrets: inherit | |
| with: | |
| workspace_name: "docs" # The 'name' from the app's package.json | |
| output_dir: "build" # The build output directory name | |
| static_web_app_name: "dx-p-itn-website-stapp-01" | |
| resource_group_name: "dx-p-itn-common-rg-01" | |
| environment: "app-prod" | |
| feed_docs_knowledge_base: | |
| # Only run after push to main with a "Version Packages" commit (changeset PR merge) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Version Packages') | |
| name: Update MCP Server Knowledge Base | |
| environment: app-prod-ci | |
| needs: deploy_to_static_web_app | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| env: | |
| ROLE_ARN: ${{ secrets.ROLE_ARN }} | |
| AWS_REGION: eu-central-1 | |
| BUCKET_NAME: dx-p-euc1-docs-kb-s3-01 | |
| OUTPUT_DIR: "upload" | |
| steps: | |
| - name: Download Artifact | |
| uses: pagopa/dx/.github/actions/download-artifact@main | |
| with: | |
| bundle_name: ${{ needs.deploy_to_static_web_app.outputs.bundle_name }} | |
| file_path: "./${{ env.OUTPUT_DIR }}" | |
| - name: Cloud Login | |
| uses: pagopa/dx/actions/csp-login@main | |
| # Upload only markdown files to the knowledge base bucket deleting objects that don't exist anymore | |
| # Also start an ingestion job to update the production knowledge base | |
| # - knowledge-base-id: AWS Console > Bedrock > Knowledge bases > dx-p-euc1-docs-bedrock-kb-01 > Knowledge base ID | |
| # - data-source-id: AWS Console > Bedrock > Knowledge bases > dx-p-euc1-docs-bedrock-kb-01 > Data sources > dx-p-euc1-docs-bedrock-kb-01-dx-docs-data-source > Data source ID | |
| - shell: bash | |
| run: | | |
| echo "Deploying documentation to knowledge base..." | |
| aws s3 sync ./${OUTPUT_DIR}/ s3://${BUCKET_NAME}/ --exclude "*" --include "*.md" --include "*.mdx" --delete | |
| aws bedrock-agent start-ingestion-job --knowledge-base-id ALSBZAYABZ --data-source-id XITRER7DER |