Initial commit #1
This file contains 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 to Prod Workspace | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Create or Update Pipelines | |
env: | |
DEEPSET_CLOUD_API_KEY: ${{ secrets.DEEPSET_CLOUD_API_KEY }} | |
DEEPSET_CLOUD_WORKSPACE_NAME: "your-prod-workspace-name" | |
run: | | |
for pipeline in pipelines/*.yaml; do | |
pipeline_content=$(cat "$pipeline" | jq -sR .) | |
response=$(curl --silent --show-error --fail \ | |
--request POST \ | |
--url "https://api.cloud.deepset.ai/api/v1/workspaces/${DEEPSET_CLOUD_WORKSPACE_NAME}/pipelines?dry_run=false" \ | |
--header "Authorization: Bearer ${DEEPSET_CLOUD_API_KEY}" \ | |
--header 'Content-Type: application/json' \ | |
--data "{ | |
\"yaml_content\": ${pipeline_content}, | |
\"deepset_cloud_version\": \"v2\" | |
}") | |
echo "Pipeline creation/update response for $pipeline: $response" | |
if [[ $response == *"error"* ]]; then | |
echo "Pipeline creation/update failed for $pipeline" | |
exit 1 | |
fi | |
done | |
- name: Validate Pipelines | |
env: | |
DEEPSET_CLOUD_API_KEY: ${{ secrets.DEEPSET_CLOUD_API_KEY }} | |
DEEPSET_CLOUD_WORKSPACE_NAME: "your-prod-workspace-name" | |
run: | | |
validation_response=$(curl --silent --show-error --fail \ | |
--request POST \ | |
--url "https://api.cloud.deepset.ai/api/v1/workspaces/${DEEPSET_CLOUD_WORKSPACE_NAME}/pipeline_validations" \ | |
--header "Authorization: Bearer ${DEEPSET_CLOUD_API_KEY}" \ | |
--header 'content-type: application/json' \ | |
--data '{"deepset_cloud_version": "v2"}') | |
echo "Validation response: $validation_response" | |
if [[ $validation_response == *"error"* ]]; then | |
echo "Pipeline validation failed" | |
exit 1 | |
fi | |
- name: Deploy Pipelines to Prod Workspace | |
env: | |
DEEPSET_CLOUD_API_KEY: ${{ secrets.DEEPSET_CLOUD_API_KEY }} | |
DEEPSET_CLOUD_WORKSPACE_NAME: "your-prod-workspace-name" | |
run: | | |
for pipeline in pipelines/*.yaml; do | |
deepset-cloud pipelines upload \ | |
--api-key "$DEEPSET_CLOUD_API_KEY" \ | |
--workspace-name "$DEEPSET_CLOUD_WORKSPACE_NAME" \ | |
--file "$pipeline" | |
done |