Repository navigation
71 lines (62 loc) · 2.89 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (62 loc) · 2.89 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
id-token: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
- name: Warn if telemetry token is absent
env:
TELEMETRY_CLIENT_TOKEN: ${{ secrets.TELEMETRY_CLIENT_TOKEN }}
run: |
if [ -z "$TELEMETRY_CLIENT_TOKEN" ]; then
echo "::warning::TELEMETRY_CLIENT_TOKEN secret is not set — production binary will be built without telemetry support"
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
with:
version: v2.14.1
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TELEMETRY_CLIENT_TOKEN: ${{ secrets.TELEMETRY_CLIENT_TOKEN }}
- name: Get Datadog credentials
id: dd-sts
uses: DataDog/dd-sts-action@639d841c72f15e4e77747bd726ef8105ce971da2 # main
with:
policy: public-datadog-code-security-mcp
- name: Trigger Datadog workflow
env:
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
DD_APP_KEY: ${{ steps.dd-sts.outputs.app_key }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME}"
SHA256_MACOS_ARM64="$(grep 'datadog-code-security-mcp-darwin-arm64.tar.gz' dist/checksums.txt | awk '{print $1}')"
SHA256_MACOS_X86_64="$(grep 'datadog-code-security-mcp-darwin-amd64.tar.gz' dist/checksums.txt | awk '{print $1}')"
SHA256_LINUX_ARM64="$(grep 'datadog-code-security-mcp-linux-arm64.tar.gz' dist/checksums.txt | awk '{print $1}')"
SHA256_LINUX_X86_64="$(grep 'datadog-code-security-mcp-linux-amd64.tar.gz' dist/checksums.txt | awk '{print $1}')"
# Wait for the short-lived credentials from dd-sts-action to fully propagate in Datadog's
# backend before triggering the workflow. Without this delay, the API call may return 403
# even though the app key has the correct permissions.
sleep 60
curl -fsS -X POST \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d "{\"meta\":{\"payload\":{\"version\":\"${VERSION}\",\"sha256_macos_arm64\":\"${SHA256_MACOS_ARM64}\",\"sha256_macos_x86_64\":\"${SHA256_MACOS_X86_64}\",\"sha256_linux_arm64\":\"${SHA256_LINUX_ARM64}\",\"sha256_linux_x86_64\":\"${SHA256_LINUX_X86_64}\"}}}" \
https://api.datadoghq.com/api/v2/workflows/b146b702-a937-4083-a80a-181994134c9d/instances