Merge pull request #301 from mongodb/development

This commit is contained in:
Mick Grove 2026-03-28 12:18:12 -07:00 committed by GitHub
commit 1d37d2983c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 25 deletions

View file

@ -1,8 +1,12 @@
name: pypi-wheels
on:
release:
types: [published]
workflow_call:
inputs:
tag:
description: "Release tag to package (e.g., v1.2.3)"
required: true
type: string
workflow_dispatch:
inputs:
tag:
@ -24,18 +28,14 @@ jobs:
id: version
shell: bash
env:
INPUT_TAG: ${{ github.event.inputs.tag || '' }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name || '' }}
GH_TOKEN: ${{ github.token }}
INPUT_TAG: ${{ inputs.tag || github.event.inputs.tag || '' }}
run: |
set -euo pipefail
if [[ "${GITHUB_EVENT_NAME}" == "release" && -n "${RELEASE_TAG_NAME}" ]]; then
TAG="${RELEASE_TAG_NAME}"
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && -n "${INPUT_TAG}" ]]; then
TAG="${INPUT_TAG}"
else
TAG=$(gh release view --repo "${{ github.repository }}" --json tagName --jq .tagName)
if [[ -z "${INPUT_TAG}" ]]; then
echo "No tag provided — cannot determine version" >&2
exit 1
fi
TAG="${INPUT_TAG}"
if [[ ! "${TAG}" =~ ^v[0-9A-Za-z._+-]+$ ]]; then
echo "Invalid tag format: ${TAG}" >&2
exit 1

View file

@ -5,11 +5,15 @@ name: Publish Docker image
# Triggers
###############################################################################
on:
# 1⃣ Traditional: run automatically when a GitHub Release is published
release:
types: [published]
# Called automatically by the release workflow after a successful build
workflow_call:
inputs:
tag:
description: "Tag to push (e.g. v1.2.3)"
required: true
type: string
# 2⃣ Manual: “Run workflow” button or `gh workflow run`
# Manual: "Run workflow" button or `gh workflow run`
workflow_dispatch:
inputs:
tag:
@ -19,7 +23,7 @@ on:
###############################################################################
permissions:
contents: read # needed for checkout + GH API
contents: read # needed for checkout
###############################################################################
jobs:
@ -31,23 +35,21 @@ jobs:
steps:
# -----------------------------------------------------------------------
# Decide which tag were going to publish
# Decide which tag we're going to publish
# -----------------------------------------------------------------------
- name: Determine tag
id: tag
shell: bash
env:
# populated only for workflow_dispatch
MANUAL_TAG: ${{ github.event.inputs.tag }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
# workflow_call passes tag here; workflow_dispatch may or may not
CALL_TAG: ${{ inputs.tag }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
RAW_TAG="${RELEASE_TAG_NAME}"
elif [[ -n "${MANUAL_TAG}" ]]; then
RAW_TAG="${MANUAL_TAG}"
if [[ -n "${CALL_TAG}" ]]; then
RAW_TAG="${CALL_TAG}"
else
# manual w/o tag → ask GitHub API for latest release tag
# workflow_dispatch without a tag → query latest release
RAW_TAG=$(gh release view --repo "${{ github.repository }}" --json tagName --jq .tagName)
fi

View file

@ -352,6 +352,8 @@ jobs:
name: Public GitHub Release
needs: [linux-x64, linux-arm64, windows, macos-x64, macos-arm64]
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
permissions:
contents: write
id-token: write
@ -405,3 +407,23 @@ jobs:
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
with:
subject-path: 'target/release/*'
# ──────────────── Publish Docker image ────────────────
publish-docker:
needs: [release]
uses: ./.github/workflows/release-docker.yml
with:
tag: ${{ needs.release.outputs.tag }}
permissions:
contents: read
packages: write
# ──────────────── Publish PyPI wheels ────────────────
publish-pypi:
needs: [release]
uses: ./.github/workflows/pypi.yml
with:
tag: ${{ needs.release.outputs.tag }}
permissions:
contents: read
id-token: write