Skip to content

[CAI-220] Add waf resource #44

[CAI-220] Add waf resource

[CAI-220] Add waf resource #44

---
name: Chatbot Reindex
on:
pull_request:
types:
- closed
branches:
- 'main'
workflow_dispatch:
inputs:
environment:
description: 'The environment used as target'
type: choice
required: true
default: dev
options:
- dev
- prod
# Allows external webhook trigger
repository_dispatch:
types:
- webhook
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
jobs:
cd_deploy:
name: Llama reindex (on ${{ matrix.environment }})
# Trigger when the PR is merged or on a webhook (e.g. trigger deploy from CMS)
if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'repository_dispatch'
runs-on: codebuild-${{ matrix.environment }}-github-runner-${{ github.run_id }}-${{ github.run_attempt }}
strategy:
matrix:
environment: ['dev']
fail-fast: false
environment: ${{ matrix.environment }}
concurrency:
group: ${{ github.workflow }}-${{ matrix.environment }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Increase action disk space
uses: ./.github/actions/increase-disk-space
- name: Setup Node.JS
uses: ./.github/actions/setup-node
- name: Install dependencies
shell: bash
run: npm ci --audit=false --fund=false
- name: Compile packages
shell: bash
run: npm run compile
- name: Build NextJS Website
uses: ./.github/actions/build-nextjs-website
with:
path_to_gitbook_docs: ${{ github.workspace }}/apps/nextjs-website/docs
cookie_domain_script: ${{ secrets.COOKIE_DOMAIN_SCRIPT }}
allow_crawler: ${{ vars.ALLOW_CRAWLER }}
cognito_user_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_ID }}
cognito_identity_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID }}
cognito_app_client_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_WEB_CLIENT_ID }}
chatbot_host: ${{ vars.NEXT_PUBLIC_CHATBOT_HOST }}
chat_max_history_messages: ${{ vars.NEXT_PUBLIC_CHAT_MAX_HISTORY_MESSAGES }}
website_name: ${{ vars.NEXT_PUBLIC_WEBSITE_NAME }}
organization_name: ${{ vars.NEXT_PUBLIC_ORGANIZATION_NAME }}
organization_logo: ${{ vars.NEXT_PUBLIC_ORGANIZATION_LOGO }}
organization_social_links: ${{ vars.NEXT_PUBLIC_ORGANIZATION_SOCIAL_LINKS }}
chatbot_active: ${{ vars.NEXT_PUBLIC_CHATBOT_ACTIVE }}
cognito_aws_region: 'eu-south-1'
strapi_endpoint: ${{ vars.STRAPI_ENDPOINT }}
strapi_api_token: ${{ secrets.STRAPI_API_TOKEN }}
fetch_from_strapi: ${{ vars.FETCH_FROM_STRAPI }}
- name: Chatbot Vector Index
uses: ./.github/actions/chatbot
with:
chatbot_lambda_name: ${{ vars.CHATBOT_LAMBDA_NAME }}
manual_deploy:
name: Llama reindex (manual on ${{ inputs.environment }})
if: github.event_name == 'workflow_dispatch'
runs-on: codebuild-${{ inputs.environment }}-github-runner-${{ github.run_id }}-${{ github.run_attempt }}
environment: ${{ inputs.environment }}
concurrency:
group: ${{ github.workflow }}-${{ inputs.environment }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Increase action disk space
uses: ./.github/actions/increase-disk-space
- name: Setup Node.JS
uses: ./.github/actions/setup-node
- name: Install dependencies
shell: bash
run: npm ci --audit=false --fund=false
- name: Compile packages
shell: bash
run: npm run compile
- name: Build NextJS Website
uses: ./.github/actions/build-nextjs-website
with:
path_to_gitbook_docs: ${{ github.workspace }}/apps/nextjs-website/docs
cookie_domain_script: ${{ secrets.COOKIE_DOMAIN_SCRIPT }}
allow_crawler: ${{ vars.ALLOW_CRAWLER }}
cognito_user_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_ID }}
cognito_identity_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID }}
cognito_app_client_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_WEB_CLIENT_ID }}
chatbot_host: ${{ vars.NEXT_PUBLIC_CHATBOT_HOST }}
chat_max_history_messages: ${{ vars.NEXT_PUBLIC_CHAT_MAX_HISTORY_MESSAGES }}
website_name: ${{ vars.NEXT_PUBLIC_WEBSITE_NAME }}
organization_name: ${{ vars.NEXT_PUBLIC_ORGANIZATION_NAME }}
organization_logo: ${{ vars.NEXT_PUBLIC_ORGANIZATION_LOGO }}
organization_social_links: ${{ vars.NEXT_PUBLIC_ORGANIZATION_SOCIAL_LINKS }}
chatbot_active: ${{ vars.NEXT_PUBLIC_CHATBOT_ACTIVE }}
cognito_aws_region: 'eu-south-1'
strapi_endpoint: ${{ vars.STRAPI_ENDPOINT }}
strapi_api_token: ${{ secrets.STRAPI_API_TOKEN }}
fetch_from_strapi: ${{ vars.FETCH_FROM_STRAPI }}
- name: Chatbot Vector Index
uses: ./.github/actions/chatbot
with:
chatbot_lambda_name: ${{ vars.CHATBOT_LAMBDA_NAME }}