Skip to content

chore(deps-dev): update grpcio-tools requirement from >=1.60 to >=1.83.1 in /sdks/python #13

chore(deps-dev): update grpcio-tools requirement from >=1.60 to >=1.83.1 in /sdks/python

chore(deps-dev): update grpcio-tools requirement from >=1.60 to >=1.83.1 in /sdks/python #13

name: release-promotion
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
pr_number:
description: Number of the release promotion pull request
required: true
type: string
tag:
description: Release tag (for example, v0.2.20)
required: true
type: string
permissions:
contents: read
pull-requests: read
jobs:
release-promotion:
name: release-promotion
runs-on: ubuntu-latest
steps:
- name: Resolve pull request metadata
id: pr
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
EVENT_PR_NUMBER: ${{ github.event.pull_request.number }}
EVENT_BASE_REF: ${{ github.event.pull_request.base.ref }}
EVENT_HEAD_REF: ${{ github.event.pull_request.head.ref }}
EVENT_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
EVENT_BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
PR_NUMBER="$EVENT_PR_NUMBER"
BASE_REF="$EVENT_BASE_REF"
HEAD_REF="$EVENT_HEAD_REF"
HEAD_SHA="$EVENT_HEAD_SHA"
BASE_SHA="$EVENT_BASE_SHA"
else
PR_NUMBER="$INPUT_PR_NUMBER"
PR_JSON=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")
BASE_REF=$(printf '%s' "$PR_JSON" | jq -r '.base.ref')
HEAD_REF=$(printf '%s' "$PR_JSON" | jq -r '.head.ref')
HEAD_SHA=$(printf '%s' "$PR_JSON" | jq -r '.head.sha')
BASE_SHA=$(printf '%s' "$PR_JSON" | jq -r '.base.sha')
fi
if [ -z "$PR_NUMBER" ] || [ "$BASE_REF" != "main" ]; then
echo "promotion PR must target main" >&2
exit 1
fi
case "$HEAD_REF" in
release/v[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "promotion PR head must be release/v<major>.<minor>.<patch>: $HEAD_REF" >&2; exit 1 ;;
esac
{
echo "number=$PR_NUMBER"
echo "base_sha=$BASE_SHA"
echo "head_sha=$HEAD_SHA"
echo "head_ref=$HEAD_REF"
} >> "$GITHUB_OUTPUT"
- name: Check out promotion branch
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.head_sha }}
fetch-depth: 0
- name: Validate release tag and Formula
env:
TAG: ${{ inputs.tag || steps.pr.outputs.head_ref }}
HEAD_SHA: ${{ steps.pr.outputs.head_sha }}
run: |
if [ "${TAG#release/}" != "$TAG" ]; then
TAG="${TAG#release/}"
fi
case "$TAG" in
v[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "invalid release tag: $TAG" >&2; exit 1 ;;
esac
git fetch origin --tags --force
TAG_COMMIT=$(git rev-parse "$TAG^{commit}")
git merge-base --is-ancestor "$TAG_COMMIT" "$HEAD_SHA" || {
echo "promotion branch does not contain release tag $TAG" >&2
exit 1
}
[ -f Formula/rcm.rb ] || { echo "Formula/rcm.rb is missing" >&2; exit 1; }
! grep -Fq 'rcm-dist' Formula/rcm.rb || { echo "Formula references archived repository" >&2; exit 1; }
grep -Fq 'recursive-context-machine/releases/download' Formula/rcm.rb
grep -Fq "version \"${TAG#v}\"" Formula/rcm.rb
HASH_COUNT=$(grep -Ec 'sha256 "[0-9a-fA-F]{64}"' Formula/rcm.rb)
[ "$HASH_COUNT" -eq 4 ] || { echo "expected four Formula SHA256 values, found $HASH_COUNT" >&2; exit 1; }
ruby -c Formula/rcm.rb
- name: Verify promotion contains release metadata
env:
BASE_SHA: ${{ steps.pr.outputs.base_sha }}
run: |
CHANGED_FILES=$(git diff --name-only "$BASE_SHA"...HEAD)
printf '%s\n' "$CHANGED_FILES"
printf '%s\n' "$CHANGED_FILES" | grep -Fxq Formula/rcm.rb || {
echo "promotion PR must update Formula/rcm.rb" >&2
exit 1
}