Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/actions/deploy-integrations-staging/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy Integrations to Staging
description: Deploys integrations to Botpress staging environment

inputs:
extra_filter:
description: 'Pnpm additional filters to select integrations to deploy'
required: false
default: ''
force:
description: 'Force re-deploying integrations'
default: 'false'
required: false
dry_run:
description: 'Ask the backend to perform validation without actually deploying'
default: 'false'
required: false

runs:
using: 'composite'
steps:
- name: Install retry-cli
shell: bash
run: pnpm add -g retry-cli
- name: Deploy Integrations to Staging
shell: bash
run: |
api_url="https://api.botpress.dev"

echo "### Logging in to $api_url ###"
pnpm bp login --api-url $api_url --workspaceId "${{ env.BP_WORKSPACEID_STAGING }}" --token "${{ env.ERMEK_STAGING_PAT }}"

redeploy=${{ inputs.force == 'true' && 1 || 0 }}
dryrun="${{ inputs.dry_run == 'true' && '--dryRun' || '' }}"
is_dry_run=${{ inputs.dry_run == 'true' && 1 || 0 }}

# Get all integration directories
integration_dirs=$(find integrations -maxdepth 1 -type d -not -path integrations)

for integration_path in $integration_dirs; do
integration=$(basename $integration_path)

# Skip if not a valid integration directory
if [ ! -f "$integration_path/package.json" ] || [ ! -f "$integration_path/integration.definition.ts" ]; then
echo "Skipping $integration (not a valid integration)"
continue
fi

# Apply extra filter if specified
if [ -n "${{ inputs.extra_filter }}" ]; then
if [[ ! "$integration" == *"${{ inputs.extra_filter }}"* ]]; then
echo "Skipping $integration (filtered out)"
continue
fi
fi

# Check if integration exists using the existing script
exists=$(./.github/scripts/integration-exists.sh $integration)

base_command="pnpm bp deploy -v -y --noBuild --public --allowDeprecated $dryrun"

if [ $exists -eq 0 ]; then
echo -e "\nDeploying integration: ### $integration ###\n"
cd $integration_path
retry -n 2 -- $base_command
cd - > /dev/null
elif [ $redeploy -eq 1 ]; then
echo -e "\nRe-deploying integration: ### $integration ###\n"
cd $integration_path
retry -n 2 -- $base_command
cd - > /dev/null
else
echo -e "\nSkipping integration: ### $integration ###\n"
fi
done
env:
ERMEK_STAGING_PAT: ${{ env.ERMEK_STAGING_PAT }}
BP_WORKSPACEID_STAGING: ${{ env.BP_WORKSPACEID_STAGING }}
56 changes: 56 additions & 0 deletions .github/workflows/deploy-integrations-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy Integrations to Staging

on:
push:
branches:
- master
paths:
- 'integrations/**'

pull_request:
paths:
- 'integrations/**'

workflow_dispatch:
inputs:
force:
description: 'Force re-deploying integrations'
type: boolean
required: false
default: false
extra_filter:
description: 'Filter integrations to deploy (partial name match)'
type: string
required: false
default: ''

permissions:
contents: read

jobs:
deploy-staging:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup dependencies
uses: ./.github/actions/setup

- name: Get changed integrations
id: changed-integrations
uses: tj-actions/changed-files@v46
with:
files: 'integrations/**'
dir_names: true
dir_names_max_depth: 2

- name: Deploy Integrations to Staging
uses: ./.github/actions/deploy-integrations-staging
with:
force: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force == 'true' || false }}
extra_filter: ${{ github.event.inputs.extra_filter || '' }}
env:
ERMEK_STAGING_PAT: ${{ secrets.ERMEK_STAGING_PAT }}
BP_WORKSPACEID_STAGING: ${{ secrets.BP_WORKSPACEID_STAGING }}
1 change: 1 addition & 0 deletions integrations/brevo-hitl/integration.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { events, configuration, channels as baseChannels, states, user } from '.
export default new IntegrationDefinition({
name: 'plus/brevo-hitl',
title: 'Brevo HITL',
// Test deployment trigger
version: '1.0.0',
readme: 'hub.md',
description: 'Brevo HITL Integration',
Expand Down
Loading