diff --git a/.github/workflows/release-dispatch.yaml b/.github/workflows/release-dispatch.yaml new file mode 100644 index 00000000..5fc5b711 --- /dev/null +++ b/.github/workflows/release-dispatch.yaml @@ -0,0 +1,78 @@ +name: Release - Open a release PR +on: + # TODO: Remove this once the workflow is working + push: + branches: + - igor/versioning/release-dispatch + workflow_dispatch: + inputs: + version: + description: Version to release + required: true + type: string + +env: + BRANCH_NAME: test-main + VERSION: ${{ inputs.version || '0.3.0' }} + +jobs: + freeze-branch: + runs-on: ubuntu-latest + permissions: + id-token: write # Needed to federate tokens. + outputs: + frozen: false + steps: + - name: Debug OIDC Claims + uses: github/actions-oidc-debugger@0705a46041e35206455b781a260e4af1c6e60b6d # main + with: + audience: "octo-debugger" + - name: Get token + uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3 + id: octo-sts + with: + scope: DataDog/dd-trace-rs + policy: release-dispatch + - name: Freeze branch + run: | + gh auth status + gh api -X GET -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/DataDog/dd-trace-rs/branches/${{ env.BRANCH_NAME }}/protection + + + # gh api -X POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + # /repos/DataDog/dd-trace-rs/branches/${{ env.BRANCH_NAME }}/protection \ + # -f '{"required_status_checks": null, "enforce_admins": null, "restrictions": null}' \ + # -f '{"required_pull_request_reviews": null}' \ + # -f '{"required_linear_history": null, "allow_force_pushes": null, "allow_deletions": null}' \ + # -f '{"dismiss_stale_reviews": null, "require_code_owner_reviews": null, "required_approving_review_count": null}' \ + # -f '{"restrictions": null}' \ + echo "frozen=false" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ steps.octo-sts.outputs.token }} + GH_PAGER: cat + + # make-release-pr: + # permissions: + # id-token: write # Enable OIDC + # pull-requests: write + # contents: write + # runs-on: ubuntu-latest + # needs: freeze-branch + # if: needs.freeze-branch.outputs.frozen == 'true' + # steps: + # - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 + # - uses: chainguard-dev/actions/setup-gitsign@0cda751b114eb55c388e88f7479292668165602a # v1.0.2 + # - name: Install cargo-release + # uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # 2.62.15 + # with: + # tool: cargo-release + + # # TODO: add release notes to the PR description ${{ steps.extract-release-notes.outputs.release-notes }} + # - uses: cargo-bins/release-pr@0c019c0e5a6b9f722578d231d43ba900cacc5ffa # 2.1.3 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # version: ${{ env.VERSION }} + # crate-name: datadog-opentelemetry + # base-branch: ${{ env.BRANCH_NAME }} + # # check-semver: "true"