Skip to content

v0.58.0

v0.58.0 #10

name: Trigger staging back-sync on release
# Production-only. On a published release, notify the staging repo to sync from
# production, shrinking the post-release sync delay (vs. the scheduled poll).
on:
release:
types: [published]
workflow_dispatch: {}
permissions:
contents: read
jobs:
notify:
runs-on: ubuntu-latest
if: github.repository == 'G-Core/gcore-python'
steps:
- name: Generate gcore-sdk-bot token
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.GCORE_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.GCORE_SDK_BOT_PRIVATE_KEY }}
owner: G-Core
repositories: gcore-python-staging
permission-contents: write
- name: Dispatch back-sync to staging
env:
DISPATCH_TOKEN: ${{ steps.app-token.outputs.token }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
payload=$(jq -n --arg ref "$REF_NAME" '{event_type:"prod-released",client_payload:{ref:$ref}}')
code=$(curl -sS -o /tmp/r.txt -w '%{http_code}' -X POST \
-H "Authorization: Bearer ${DISPATCH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/G-Core/gcore-python-staging/dispatches \
-d "$payload")
[ "$code" = "204" ] && echo "back-sync dispatched to staging" || { echo "dispatch failed $code"; cat /tmp/r.txt; exit 1; }