From f6cea42736934d1e1d0dc09e1d2dc81a0b17253a Mon Sep 17 00:00:00 2001 From: Joaquin Date: Wed, 20 Aug 2025 09:44:16 -0500 Subject: [PATCH 1/4] feat: add auto-deployment trigger for dev branch - Added trigger-dev-deployment.yml workflow - Triggers bitmaker-cloud-deploy when pushing to dev branch - Sends repository dispatch with commit info and metadata - Enables automatic deployment to development environment Co-Authored-By: Claude --- .github/workflows/trigger-dev-deployment.yml | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/trigger-dev-deployment.yml diff --git a/.github/workflows/trigger-dev-deployment.yml b/.github/workflows/trigger-dev-deployment.yml new file mode 100644 index 00000000..3e544942 --- /dev/null +++ b/.github/workflows/trigger-dev-deployment.yml @@ -0,0 +1,64 @@ +name: Trigger Development Deployment + +on: + push: + branches: [dev] + workflow_dispatch: + +jobs: + trigger-deployment: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Trigger deployment in bitmaker-cloud-deploy + run: | + echo "🚀 Triggering deployment for commit: ${{ github.sha }}" + echo "Branch: ${{ github.ref_name }}" + echo "Triggered by: ${{ github.actor }}" + + response=$(curl -X POST \ + -H "Authorization: token ${{ secrets.DEPLOY_TRIGGER_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "${{ secrets.DEPLOY_WEBHOOK_URL }}" \ + -d '{ + "event_type": "deploy-dev-auto", + "client_payload": { + "source_repo": "estela", + "branch": "${{ github.ref_name }}", + "commit": "${{ github.sha }}", + "triggered_by": "${{ github.actor }}", + "commit_message": "${{ github.event.head_commit.message }}" + } + }' \ + -w "\n%{http_code}" \ + -s) + + http_code=$(echo "$response" | tail -n1) + body=$(echo "$response" | sed '$d') + + if [ "$http_code" = "204" ]; then + echo "✅ Deployment triggered successfully!" + else + echo "❌ Failed to trigger deployment" + echo "HTTP Status: $http_code" + echo "Response: $body" + exit 1 + fi + + - name: Add deployment status comment + if: github.event_name == 'push' + uses: actions/github-script@v6 + with: + script: | + const commit_sha = context.sha; + const message = `🚀 Deployment to development environment has been triggered!\n\nCommit: ${commit_sha.substring(0, 7)}`; + + // Create a commit comment + await github.rest.repos.createCommitComment({ + owner: context.repo.owner, + repo: context.repo.repo, + commit_sha: commit_sha, + body: message + }); \ No newline at end of file From 4cba046581611f0ef62b07cc6985c24da0fdcb6e Mon Sep 17 00:00:00 2001 From: Joaquin Date: Wed, 20 Aug 2025 09:50:48 -0500 Subject: [PATCH 2/4] fix: escape JSON properly in deployment trigger workflow - Fixed JSON parsing error by properly escaping quotes - Added Content-Type header for clarity - Escaped commit messages to handle special characters Co-Authored-By: Claude --- .github/workflows/trigger-dev-deployment.yml | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/trigger-dev-deployment.yml b/.github/workflows/trigger-dev-deployment.yml index 3e544942..c7f5d2d2 100644 --- a/.github/workflows/trigger-dev-deployment.yml +++ b/.github/workflows/trigger-dev-deployment.yml @@ -18,20 +18,24 @@ jobs: echo "Branch: ${{ github.ref_name }}" echo "Triggered by: ${{ github.actor }}" + # Escape commit message for JSON + COMMIT_MSG=$(echo "${{ github.event.head_commit.message }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + response=$(curl -X POST \ -H "Authorization: token ${{ secrets.DEPLOY_TRIGGER_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ + -H "Content-Type: application/json" \ "${{ secrets.DEPLOY_WEBHOOK_URL }}" \ - -d '{ - "event_type": "deploy-dev-auto", - "client_payload": { - "source_repo": "estela", - "branch": "${{ github.ref_name }}", - "commit": "${{ github.sha }}", - "triggered_by": "${{ github.actor }}", - "commit_message": "${{ github.event.head_commit.message }}" + -d "{ + \"event_type\": \"deploy-dev-auto\", + \"client_payload\": { + \"source_repo\": \"estela\", + \"branch\": \"${{ github.ref_name }}\", + \"commit\": \"${{ github.sha }}\", + \"triggered_by\": \"${{ github.actor }}\", + \"commit_message\": \"${COMMIT_MSG}\" } - }' \ + }" \ -w "\n%{http_code}" \ -s) From 1a959cd109f6604d589b913e917770aeda264b21 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Wed, 20 Aug 2025 09:44:16 -0500 Subject: [PATCH 3/4] feat: add auto-deployment trigger for dev branch - Added trigger-dev-deployment.yml workflow - Triggers bitmaker-cloud-deploy when pushing to dev branch - Sends repository dispatch with commit info and metadata - Enables automatic deployment to development environment Co-Authored-By: Claude --- .github/workflows/trigger-dev-deployment.yml | 22 ++++++++------------ CLAUDE.md | 3 +++ 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 CLAUDE.md diff --git a/.github/workflows/trigger-dev-deployment.yml b/.github/workflows/trigger-dev-deployment.yml index c7f5d2d2..3e544942 100644 --- a/.github/workflows/trigger-dev-deployment.yml +++ b/.github/workflows/trigger-dev-deployment.yml @@ -18,24 +18,20 @@ jobs: echo "Branch: ${{ github.ref_name }}" echo "Triggered by: ${{ github.actor }}" - # Escape commit message for JSON - COMMIT_MSG=$(echo "${{ github.event.head_commit.message }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') - response=$(curl -X POST \ -H "Authorization: token ${{ secrets.DEPLOY_TRIGGER_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ - -H "Content-Type: application/json" \ "${{ secrets.DEPLOY_WEBHOOK_URL }}" \ - -d "{ - \"event_type\": \"deploy-dev-auto\", - \"client_payload\": { - \"source_repo\": \"estela\", - \"branch\": \"${{ github.ref_name }}\", - \"commit\": \"${{ github.sha }}\", - \"triggered_by\": \"${{ github.actor }}\", - \"commit_message\": \"${COMMIT_MSG}\" + -d '{ + "event_type": "deploy-dev-auto", + "client_payload": { + "source_repo": "estela", + "branch": "${{ github.ref_name }}", + "commit": "${{ github.sha }}", + "triggered_by": "${{ github.actor }}", + "commit_message": "${{ github.event.head_commit.message }}" } - }" \ + }' \ -w "\n%{http_code}" \ -s) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..12589aed --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,3 @@ +- When deploy to kubernetes please check that we're using the do-nyc1-scraping-development-cluster cluster and if not please request a confirmation +- Use amd64 docker buildings for default +- Use aws-vault with creds estela_api_creds to run aws commands \ No newline at end of file From b016a48b2fe9cf44362d49a09b4d8ca7937e85be Mon Sep 17 00:00:00 2001 From: joaquin Date: Wed, 20 Aug 2025 12:28:18 -0500 Subject: [PATCH 4/4] feat: add auto-deployment trigger for dev branch (#261) * feat: add auto-deployment trigger for dev branch - Added trigger-dev-deployment.yml workflow - Triggers bitmaker-cloud-deploy when pushing to dev branch - Sends repository dispatch with commit info and metadata - Enables automatic deployment to development environment Co-Authored-By: Claude * fix: escape JSON properly in deployment trigger workflow - Fixed JSON parsing error by properly escaping quotes - Added Content-Type header for clarity - Escaped commit messages to handle special characters Co-Authored-By: Claude --------- Co-authored-by: Claude --- .github/workflows/trigger-dev-deployment.yml | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/trigger-dev-deployment.yml b/.github/workflows/trigger-dev-deployment.yml index 3e544942..c7f5d2d2 100644 --- a/.github/workflows/trigger-dev-deployment.yml +++ b/.github/workflows/trigger-dev-deployment.yml @@ -18,20 +18,24 @@ jobs: echo "Branch: ${{ github.ref_name }}" echo "Triggered by: ${{ github.actor }}" + # Escape commit message for JSON + COMMIT_MSG=$(echo "${{ github.event.head_commit.message }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + response=$(curl -X POST \ -H "Authorization: token ${{ secrets.DEPLOY_TRIGGER_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ + -H "Content-Type: application/json" \ "${{ secrets.DEPLOY_WEBHOOK_URL }}" \ - -d '{ - "event_type": "deploy-dev-auto", - "client_payload": { - "source_repo": "estela", - "branch": "${{ github.ref_name }}", - "commit": "${{ github.sha }}", - "triggered_by": "${{ github.actor }}", - "commit_message": "${{ github.event.head_commit.message }}" + -d "{ + \"event_type\": \"deploy-dev-auto\", + \"client_payload\": { + \"source_repo\": \"estela\", + \"branch\": \"${{ github.ref_name }}\", + \"commit\": \"${{ github.sha }}\", + \"triggered_by\": \"${{ github.actor }}\", + \"commit_message\": \"${COMMIT_MSG}\" } - }' \ + }" \ -w "\n%{http_code}" \ -s)