Skip to content

Commit

Permalink
ci: 🎡 use gh cli for creating release PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Mar 10, 2024
1 parent 7fa6034 commit f08c88e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit f08c88e

Please sign in to comment.