Skip to content

Commit a52fe96

Browse files
ci(DATAGO-136556): tag plugin release in linearb (#168)
1 parent 4298d85 commit a52fe96

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
permissions:
2424
contents: read
2525
id-token: write
26+
outputs:
27+
normalized_project: ${{ steps.validate.outputs.project_name }}
28+
release_tag: ${{ steps.validate.outputs.release_tag }}
2629
steps:
2730
- name: Checkout
2831
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -140,3 +143,50 @@ jobs:
140143
echo "**Release Tag:** ${{ steps.release.outputs.release_tag }}" >> "$GITHUB_STEP_SUMMARY"
141144
echo "**Release URL:** ${{ steps.release.outputs.release_url }}" >> "$GITHUB_STEP_SUMMARY"
142145
echo "**Publish Target:** ${{ steps.publish-target.outputs.target_name }}" >> "$GITHUB_STEP_SUMMARY"
146+
linearb:
147+
name: LinearB (release)
148+
needs: publish
149+
environment: linearb
150+
runs-on: ubuntu-latest
151+
steps:
152+
- name: Update LinearB deployment
153+
env:
154+
LINEARB_API_TOKEN: ${{ secrets.LINEARB_API_TOKEN }}
155+
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
156+
REF_NAME: ${{ needs.publish.outputs.release_tag }}
157+
SERVICE_NAME: ${{ needs.publish.outputs.normalized_project }}
158+
run: |
159+
json_payload=$(jq -n \
160+
--arg repo_url "$REPO_URL" \
161+
--arg ref_name "$REF_NAME" \
162+
--arg stage "release" \
163+
--arg service "$SERVICE_NAME" \
164+
'{
165+
repo_url: $repo_url,
166+
ref_name: $ref_name,
167+
stage: $stage,
168+
services: [$service]
169+
}')
170+
171+
echo "Payload:"
172+
echo "$json_payload" | jq .
173+
174+
RESPONSE=$(curl --silent --location --request POST \
175+
'https://public-api.linearb.io/api/v1/deployments' \
176+
--header "x-api-key: ${LINEARB_API_TOKEN}" \
177+
--header 'Content-Type: application/json' \
178+
--data-raw "$json_payload" \
179+
--write-out "\n%{http_code}")
180+
181+
HTTP_STATUS=$(echo "$RESPONSE" | tail -n1)
182+
RESPONSE_BODY=$(echo "$RESPONSE" | sed '$ d')
183+
184+
echo "HTTP Status: $HTTP_STATUS"
185+
echo "$RESPONSE_BODY" | jq '.' 2>/dev/null || echo "$RESPONSE_BODY"
186+
187+
if [[ "$HTTP_STATUS" -ge 200 ]] && [[ "$HTTP_STATUS" -lt 300 ]]; then
188+
echo "LinearB deployment marked successfully"
189+
else
190+
echo "LinearB API call failed with status $HTTP_STATUS"
191+
exit 1
192+
fi

0 commit comments

Comments
 (0)