Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: 🎡 use gh cli for creating release PRs #136

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading