Skip to content

ci(release): gate release-trigger on the release environment #2512

ci(release): gate release-trigger on the release environment

ci(release): gate release-trigger on the release environment #2512

name: Dispatch Release

Check failure on line 1 in .github/workflows/release-dispatch.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release-dispatch.yml

Invalid workflow file

(Line: 95, Col: 11): Unexpected symbol: '+'. Located at position 20 within expression: strategy.job-index + 1
# Reusable workflow — intended to be called by a release-trigger workflow in an
# integration repository (integrations-core, integrations-extras, marketplace).
on:
workflow_call:
inputs:
source-repo:
description: "Source repository name (e.g. integrations-core, integrations-extras, marketplace)"
required: false
type: string
packages:
description: >-
Packages to release. Accepts a JSON array (e.g. '["postgres","datadog_checks_base"]'),
or omit to auto-detect from tags pointing at the specified ref.
required: false
type: string
source-repo-ref:
description: "Commit SHA or ref to build from"
required: false
type: string
dry-run:
description: >-
When true, print what would be released and where without pushing tags
or triggering downstream wheel builds.
required: false
type: boolean
default: false
ddev-version:
description: "ddev version, pinned by default."
required: false
type: string
is-stable-release:
description: "'true' for master/X.X.x (blocks pre-releases), 'false' for alpha/beta/rc (blocks stable). Unset defaults to stable behavior."
required: false
type: string
permissions:
id-token: write
contents: write # ddev needs to push tags
env:
# Default ddev version when callers don't pass `ddev-version`. Tracked by Renovate.
# renovate: datasource=pypi depName=ddev
DEFAULT_DDEV_VERSION: "14.3.2"
jobs:
prepare:
name: Tag releases and build dispatch batches
runs-on: ubuntu-latest
outputs:
has_packages: ${{ steps.prepare.outputs.has_packages }}
batches: ${{ steps.release-dispatch.outputs.batches }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # ddev needs full tag history
- name: Install ddev
run: pip install "ddev==${{ inputs.ddev-version || env.DEFAULT_DDEV_VERSION }}"
- name: Configure ddev
env:
SOURCE_REPO: ${{ inputs.source-repo || 'integrations-core' }}
run: |
REPO_SHORT="${SOURCE_REPO#integrations-}"
ddev config set upgrade_check false
ddev config set repos.${REPO_SHORT} .
ddev config set repo ${REPO_SHORT}
- name: Prepare dispatch
id: prepare
env:
DRY_RUN: ${{ inputs.dry-run }}
SELECTED_PACKAGES: ${{ inputs.packages }}
SOURCE_REPO: ${{ inputs.source-repo || 'integrations-core' }}
REF: ${{ inputs.source-repo-ref || github.sha }}
IS_STABLE_RELEASE: ${{ inputs.is-stable-release }}
run: python .github/workflows/scripts/release_prepare.py
- name: Build dispatch batches
id: release-dispatch
if: steps.prepare.outputs.has_packages == 'true'
env:
PACKAGES: ${{ steps.prepare.outputs.packages }}
SOURCE_REPO: ${{ inputs.source-repo || 'integrations-core' }}
REF: ${{ inputs.source-repo-ref || github.sha }}
DRY_RUN: ${{ inputs.dry-run }}
run: python .github/workflows/scripts/release_dispatch.py
dispatch:
name: Dispatch wheel builds (batch ${{ strategy.job-index + 1 }})
needs: prepare
if: needs.prepare.outputs.has_packages == 'true' && !inputs.dry-run
runs-on: ubuntu-latest
environment: release
strategy:
matrix:
payload: ${{ fromJson(needs.prepare.outputs.batches) }}
steps:
- name: Get GitHub token via dd-octo-sts
id: octo-sts
uses: DataDog/dd-octo-sts-action@08f2144903ced3254a3dafec2592563409ba2aa0 # v1.0.1
with:
scope: DataDog/agent-integration-wheels-release
policy: integrations-core.dispatch-wheel-builds
- name: Dispatch release
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ steps.octo-sts.outputs.token }}
repository: DataDog/agent-integration-wheels-release
event-type: build-wheels
client-payload: ${{ toJson(matrix.payload) }}