|
85 | 85 | - notify
|
86 | 86 | - verify
|
87 | 87 | - shared-pipeline # OCI packaging
|
| 88 | + - pre-release |
88 | 89 | - release
|
89 | 90 |
|
90 | 91 | variables:
|
|
1403 | 1404 | UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
|
1404 | 1405 | UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
|
1405 | 1406 |
|
| 1407 | +"generate github token": |
| 1408 | + stage: pre-release |
| 1409 | + image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1 |
| 1410 | + tags: [ "arch:amd64" ] |
| 1411 | + only: |
| 1412 | + refs: |
| 1413 | + - /^ddtrace-.*$/ |
| 1414 | + id_tokens: |
| 1415 | + DDOCTOSTS_ID_TOKEN: |
| 1416 | + aud: dd-octo-sts |
| 1417 | + script: |
| 1418 | + - echo "Generating GitHub token for release..." |
| 1419 | + - dd-octo-sts debug --scope DataDog/dd-trace-php --policy gitlab-ci-publish-release |
| 1420 | + - dd-octo-sts token --scope DataDog/dd-trace-php --policy gitlab-ci-publish-release > github_token.txt |
| 1421 | + # Verify token works |
| 1422 | + - export GITHUB_TOKEN=$(cat github_token.txt) |
| 1423 | + - 'curl -f -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/DataDog/dd-trace-php | jq -r .name' |
| 1424 | + - echo "Token generated and verified successfully" |
| 1425 | + artifacts: |
| 1426 | + paths: |
| 1427 | + - github_token.txt |
| 1428 | + expire_in: 1 hour |
| 1429 | + when: on_success |
| 1430 | + variables: |
| 1431 | + # Prevent token from appearing in logs |
| 1432 | + GITHUB_TOKEN: "[MASKED]" |
| 1433 | + |
1406 | 1434 | "publish release to github":
|
1407 | 1435 | stage: release
|
1408 | 1436 | image: registry.ddbuild.io/images/mirror/php:8.2-cli
|
|
1411 | 1439 | refs:
|
1412 | 1440 | - /^ddtrace-.*$/
|
1413 | 1441 | needs:
|
| 1442 | + - job: "generate github token" |
| 1443 | + artifacts: true |
1414 | 1444 | - job: "datadog-setup.php"
|
1415 | 1445 | artifacts: true
|
1416 | 1446 | - job: "package extension windows"
|
|
1420 | 1450 | artifacts: true
|
1421 | 1451 | <?php endforeach; ?>
|
1422 | 1452 | script:
|
1423 |
| - - if [ -z ${GITHUB_RELEASE_PAT} ]; then export GITHUB_RELEASE_PAT=$(aws ssm get-parameter --region us-east-1 --name ci.$CI_PROJECT_NAME.gh_token --with-decryption --query "Parameter.Value" --out text); fi |
1424 |
| - - php tooling/bin/create_release.php packages |
| 1453 | + - echo "Using pre-generated GitHub token for release..." |
| 1454 | + - export GITHUB_RELEASE_PAT=$(cat github_token.txt) |
| 1455 | + - php tooling/ci/create_release.php packages |
| 1456 | + after_script: |
| 1457 | + # Clean up token file (token will expire automatically in 1 hour) |
| 1458 | + - rm -f github_token.txt |
| 1459 | + variables: |
| 1460 | + # Prevent token from appearing in logs |
| 1461 | + GITHUB_RELEASE_PAT: "[MASKED]" |
0 commit comments