From 15b88743557648d2630b242b831f27a01a38430a Mon Sep 17 00:00:00 2001 From: David Gidwani Date: Sun, 10 Mar 2024 16:48:58 -0400 Subject: [PATCH] ci: :ferris_wheel: use gh cli for creating release PRs --- .github/workflows/publish.yml | 14 ++++++++++++-- .github/workflows/release.yml | 19 ++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f60a9c0..8393e3c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,16 +8,26 @@ on: workflow_dispatch: jobs: + build: + name: Build source distribution and wheels + uses: ./.github/workflows/wheels.yml + if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == ${{ vars.RELEASE_PR_BRANCH || 'create-pull-request/patch' }} + publish: runs-on: ubuntu-latest if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == ${{ vars.RELEASE_PR_BRANCH || 'create-pull-request/patch' }} concurrency: publish - outputs: - should-publish: + needs: [build] + permissions: + id-token: write + contents: write steps: - name: Checkout code uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Publish to GitHub Releases if: github.event_name == 'workflow_dispatch' uses: python-semantic-release/upload-to-gh-release@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfa0233..95a8e4e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,20 +70,13 @@ jobs: force: "patch" github_token: ${{ secrets.GITHUB_TOKEN }} root_options: "-v" - push: "false" - name: Create PR - id: cpr - uses: peter-evans/create-pull-request@v6 if: steps.release.outputs.released == 'true' - with: - base: main - assignees: ${{ github.repository_owner }} - title: "Release ${{ steps.release.outputs.version }}" - env: - # ☠️ https://github.com/peter-evans/create-pull-request/issues/60#issuecomment-1923812338 - GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} - - - name: Finalize run: | - echo 🪄✨ PR created at: ${{ steps.cpr.outputs.pull-request-url }} + gh pr create -B main -H $RELEASE_PR_BRANCH \ + --title 'Merge $RELEASE_PR_BRANCH into main' \ + --body '🤖' + env: + PR_TITLE: "Release ${{ steps.release.outputs.version }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}