chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
name: Deploy Plugins
|
||||
description: Deploys plugins
|
||||
|
||||
inputs:
|
||||
environment:
|
||||
type: choice
|
||||
description: 'Environment to deploy to'
|
||||
required: true
|
||||
options:
|
||||
- staging
|
||||
- production
|
||||
extra_filter:
|
||||
type: string
|
||||
description: 'Pnpm additional filters to select plugins to deploy'
|
||||
required: false
|
||||
default: ''
|
||||
force:
|
||||
type: boolean
|
||||
description: 'Force re-deploying plugins'
|
||||
default: false
|
||||
required: false
|
||||
token_cloud_ops_account:
|
||||
description: 'Cloud Ops account token'
|
||||
required: true
|
||||
cloud_ops_workspace_id:
|
||||
description: 'Cloud Ops workspace id'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Deploys Plugins
|
||||
shell: bash
|
||||
env:
|
||||
INPUT_ENVIRONMENT: ${{ inputs.environment }}
|
||||
INPUT_FORCE: ${{ inputs.force }}
|
||||
INPUT_EXTRA_FILTER: ${{ inputs.extra_filter }}
|
||||
TOKEN_CLOUD_OPS_ACCOUNT: ${{ inputs.token_cloud_ops_account }}
|
||||
CLOUD_OPS_WORKSPACE_ID: ${{ inputs.cloud_ops_workspace_id }}
|
||||
run: |
|
||||
if [ "$INPUT_ENVIRONMENT" = "staging" ]; then
|
||||
api_url="https://api.botpress.dev"
|
||||
else
|
||||
api_url="https://api.botpress.cloud"
|
||||
fi
|
||||
|
||||
# login
|
||||
|
||||
echo "### Logging in to $api_url ###"
|
||||
pnpm bp login -y --api-url "$api_url" --workspaceId "$CLOUD_OPS_WORKSPACE_ID" --token "$TOKEN_CLOUD_OPS_ACCOUNT"
|
||||
|
||||
# deploy
|
||||
|
||||
if [ "$INPUT_FORCE" = "true" ]; then
|
||||
redeploy=1
|
||||
else
|
||||
redeploy=0
|
||||
fi
|
||||
|
||||
all_filters="-F '{plugins/*}' $INPUT_EXTRA_FILTER"
|
||||
list_plugins_cmd="pnpm list $all_filters --json"
|
||||
plugin_paths=$(eval "$list_plugins_cmd" | jq -r 'map(.path) | .[]')
|
||||
|
||||
for plugin_path in $plugin_paths; do
|
||||
plugin=$(basename "$plugin_path")
|
||||
exists=$(./.github/scripts/plugin-exists.sh "$plugin")
|
||||
|
||||
base_command="bp deploy -v -y --visibility public"
|
||||
|
||||
if [ "$exists" -eq 0 ]; then
|
||||
echo -e "\nDeploying plugin: ### $plugin ###\n"
|
||||
pnpm retry -n 2 -- pnpm -F "{plugins/$plugin}" -c exec -- "$base_command"
|
||||
elif [ "$redeploy" -eq 1 ]; then
|
||||
echo -e "\nRe-deploying plugin: ### $plugin ###\n"
|
||||
pnpm retry -n 2 -- pnpm -F "{plugins/$plugin}" -c exec -- "$base_command"
|
||||
else
|
||||
echo -e "\nSkipping plugin: ### $plugin ###\n"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user