-
Notifications
You must be signed in to change notification settings - Fork 1.5k
99 lines (89 loc) · 3.65 KB
/
release-dispatch.yml
File metadata and controls
99 lines (89 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Dispatch Release
# 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"]'),
'all' to release every Python package in the repo, or omit to auto-detect from new tags.
required: false
type: string
source-repo-ref:
description: "Commit SHA or ref to build from"
required: false
type: string
target:
description: "Target environment (dev = no tag push, dev S3; prod = push tags, prod S3)"
required: false
type: string
default: prod # callers (e.g. release-trigger.yml) typically override this
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
jobs:
dispatch:
name: Tag releases and dispatch wheel builds
runs-on: ubuntu-latest
environment: release
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 && format('=={0}', inputs.ddev-version) || '==14.3.2' }}"
- 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:
TARGET: ${{ inputs.target }}
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: Get GitHub token via dd-octo-sts
if: steps.prepare.outputs.has_packages == 'true' && !inputs.dry-run
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
if: steps.prepare.outputs.has_packages == 'true'
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
PACKAGES: ${{ steps.prepare.outputs.packages }}
SOURCE_REPO: ${{ inputs.source-repo || 'integrations-core' }}
REF: ${{ inputs.source-repo-ref || github.sha }}
TARGET: ${{ inputs.target }}
DRY_RUN: ${{ inputs.dry-run }}
run: python .github/workflows/scripts/release_dispatch.py