Skip to content

Commit e2d34cf

Browse files
authored
chore: update PyPI publish workflow to use release-please-action for auto-release management (#230)
# Description Integration with release-please allows to deprecate the use of personal access tokens. - [x] Deprecate Github PAT - [x] Switch to release-please
1 parent cc87fb9 commit e2d34cf

File tree

3 files changed

+26
-36
lines changed

3 files changed

+26
-36
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,52 @@ name: Publish new version on PyPi
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
version:
7-
type: string
8-
description: Set new version!
9-
required: true
5+
push:
6+
branches:
7+
- master
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
repository-projects: read # this is required by release-please-action to set the auto-release tags
14+
15+
# Note for release-please-action:
16+
# The action will set the auto-release tags for the release PR. If these tags do not already exist, the action will fail to create them.
17+
# Therefore, make sure that the tags are created in the repository before running the release workflow: `autorelease: pending`, `autorelease: tagged`
1018

1119
jobs:
1220
publish:
1321
runs-on: ubuntu-22.04
1422

1523
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v3
24+
- uses: googleapis/release-please-action@v4
25+
id: release
1826
with:
19-
token: ${{ secrets.PYPI_PUBLISH_PAT }}
20-
fetch-depth: 0
21-
ref: master
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
release-type: python
2229

23-
- name: Git Config
24-
run: |
25-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
26-
git config --global user.name "github-actions[bot]"
27-
28-
- name: Set package version in version.py
29-
run: |
30-
echo "__version__ = \"${{ inputs.version }}\"" > honeybadger/version.py
31-
cat honeybadger/version.py
32-
33-
- name: Update changelog
34-
run: |
35-
printf -v date '%(%Y-%m-%d)T\n' -1
36-
sed -i "6 a ## [${{ inputs.version }}] - $date" CHANGELOG.md
37-
sed -i '/## \[Unreleased\]/{G;}' CHANGELOG.md
38-
cat CHANGELOG.md
30+
# The logic below handles Pypi publishing.
31+
- name: Checkout
32+
uses: actions/checkout@v5
33+
if: ${{ steps.release.outputs.release_created }}
3934

4035
- name: Setup python
36+
if: ${{ steps.release.outputs.release_created }}
4137
uses: actions/setup-python@v4
4238
with:
4339
python-version: '3.9'
4440

4541
- name: Build for python 3
42+
if: ${{ steps.release.outputs.release_created }}
4643
run: |
4744
pip install --upgrade twine wheel
4845
python setup.py bdist_wheel
4946
ls dist
5047
5148
- name: Upload
49+
if: ${{ steps.release.outputs.release_created }}
5250
env:
5351
TWINE_USERNAME: __token__
5452
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
5553
run: twine upload dist/*
56-
57-
- name: Push version on git
58-
run: |
59-
git commit -am "Release ${{ inputs.version }}"
60-
git tag v${{ inputs.version }}
61-
git push origin master --tags

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ All notable changes to this project will be documented in this file. See [Keep a
33
CHANGELOG](http://keepachangelog.com/) for how to update this file. This project
44
adheres to [Semantic Versioning](http://semver.org/).
55

6-
## [Unreleased]
7-
8-
## [1.1] - 2025-10-07
6+
## [1.1.0] - 2025-10-07
97
- Add Insights automatic instrumentation (#215)
108

119
## [1.0.3] - 2025-07-21

honeybadger/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1"
1+
__version__ = "1.1.0"

0 commit comments

Comments
 (0)