Skip to content

Commit 0f7df8e

Browse files
authored
Updated Tinybird CI to trigger & follow infra workflow (#27058)
Ghost CI now triggers & waits for the dispatched traffic analytics workflow and mirrors its final result. This moves the Tinybird deploy check out of this repo, over to an internally managed repo.
1 parent 9fc5341 commit 0f7df8e

2 files changed

Lines changed: 38 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,6 @@ jobs:
738738
image: tinybirdco/tinybird-local:latest
739739
ports:
740740
- 7181:7181
741-
env:
742-
TINYBIRD_HOST: ${{ secrets.TINYBIRD_HOST }}
743-
TINYBIRD_TOKEN: ${{ secrets.TINYBIRD_TOKEN }}
744-
TINYBIRD_HOST_STAGING: ${{ secrets.TINYBIRD_HOST_STAGING }}
745-
TINYBIRD_TOKEN_STAGING: ${{ secrets.TINYBIRD_TOKEN_STAGING }}
746741
steps:
747742
- uses: actions/checkout@v6
748743
- name: Install Tinybird CLI
@@ -751,10 +746,43 @@ jobs:
751746
run: tb build
752747
- name: Test project
753748
run: tb test run
754-
- name: Deployment check - Staging
755-
run: tb --cloud --host ${{ env.TINYBIRD_HOST_STAGING }} --token ${{ env.TINYBIRD_TOKEN_STAGING }} deploy --check
756-
- name: Deployment check - Production
757-
run: tb --cloud --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} deploy --check
749+
- name: Trigger and watch traffic analytics infra Tinybird workflow
750+
if: github.repository == 'TryGhost/Ghost'
751+
env:
752+
GH_TOKEN: ${{ secrets.TRAFFIC_ANALYTICS_GITHUB_TOKEN }}
753+
run: |
754+
set -euo pipefail
755+
756+
REPO="TryGhost/traffic-analytics-infra"
757+
WORKFLOW="tinybird.yml"
758+
BRANCH="main"
759+
DISPATCH_RESPONSE=$(gh api \
760+
--method POST \
761+
-H "Accept: application/vnd.github+json" \
762+
"repos/$REPO/actions/workflows/$WORKFLOW/dispatches" \
763+
--input - <<EOF
764+
{
765+
"ref": "$BRANCH",
766+
"return_run_details": true,
767+
"inputs": {
768+
"ghost_ref": "${{ github.sha }}",
769+
"caller_run_id": "${{ github.run_id }}",
770+
"run_local_tests": false
771+
}
772+
}
773+
EOF
774+
)
775+
776+
RUN_ID=$(printf '%s' "$DISPATCH_RESPONSE" | jq -r '.workflow_run_id // empty')
777+
RUN_URL=$(printf '%s' "$DISPATCH_RESPONSE" | jq -r '.html_url // .run_url // empty')
778+
779+
if [ -z "$RUN_ID" ]; then
780+
echo "::error::Unable to find the triggered workflow run in $REPO"
781+
exit 1
782+
fi
783+
784+
echo "Watching remote workflow run: $RUN_URL"
785+
gh run watch "$RUN_ID" --repo "$REPO" --exit-status
758786
759787
job_ghost-cli:
760788
name: Ghost-CLI tests

ghost/core/core/server/data/tinybird/tests/api_kpis.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
- name: Date range
34
description: All fixture data
45
parameters: site_uuid=mock_site_uuid&date_from=2100-01-01&date_to=2100-01-07

0 commit comments

Comments
 (0)