Skip to content

Commit 4d9c16f

Browse files
authored
Update release.yaml
1 parent 91e248a commit 4d9c16f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ name: Publish on PyPI
22
on:
33
release:
44
types: [published]
5+
workflow_dispatch:
6+
inputs:
7+
candidate:
8+
description: 'Release candidate.'
9+
required: true
10+
type: boolean
11+
default: true
12+
test_pypi:
13+
description: 'Test PyPi.'
14+
type: boolean
15+
default: false
516
jobs:
617
pypi:
718
name: PyPI Release
@@ -40,3 +51,30 @@ jobs:
4051
make package
4152
- name: Publish a Python distribution to PyPI
4253
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
repository-url: ${{ inputs.test_pypi && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
56+
57+
- name: Bump version to next candidate
58+
if: ${{ inputs.candidate && !inputs.test_pypi }}
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
62+
make bumpversion-candidate
63+
64+
- name: Create pull request
65+
id: cpr
66+
uses: peter-evans/create-pull-request@v4
67+
with:
68+
token: ${{ secrets.GH_ACCESS_TOKEN }}
69+
commit-message: bumpversion-candidate
70+
title: Automated Bump Version Candidate
71+
body: "This is an auto-generated PR that bumps the version to the next candidate."
72+
branch: bumpversion-candidate-update
73+
branch-suffix: short-commit-hash
74+
base: main
75+
76+
- name: Enable Pull Request Automerge
77+
if: ${{ steps.cpr.outputs.pull-request-operation == 'created' }}
78+
run: gh pr merge "${{ steps.cpr.outputs.pull-request-number }}" --squash --auto
79+
env:
80+
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)