Skip to content

Commit 78cd7de

Browse files
committed
chore: replace manual PyPI workflow with release-please
Automates versioning, changelogs, and PyPI publishing based on conventional commits. Pushes to main now open/update a Release PR instead of attempting to publish directly.
1 parent 5f7338b commit 78cd7de

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
name: Publish to PyPI
1+
name: Release Please
22

33
on:
44
push:
55
branches: [main]
66

7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
711
jobs:
12+
release-please:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
release_created: ${{ steps.release.outputs.release_created }}
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
id: release
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
822
publish:
23+
needs: release-please
24+
if: needs.release-please.outputs.release_created == 'true'
925
runs-on: ubuntu-latest
1026
permissions:
11-
id-token: write # Required for trusted publishing
27+
id-token: write
1228
steps:
1329
- uses: actions/checkout@v4
1430

@@ -24,5 +40,3 @@ jobs:
2440

2541
- name: Publish to PyPI
2642
uses: pypa/gh-action-pypi-publish@release/v1
27-
with:
28-
skip-existing: true

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.2.1"
3+
}

release-please-config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "python",
5+
"package-name": "python-eia",
6+
"extra-files": [
7+
"pyproject.toml"
8+
],
9+
"changelog-sections": [
10+
{ "type": "feat", "section": "Features" },
11+
{ "type": "fix", "section": "Bug Fixes" },
12+
{ "type": "perf", "section": "Performance" },
13+
{ "type": "docs", "section": "Documentation", "hidden": true },
14+
{ "type": "chore", "section": "Miscellaneous", "hidden": true }
15+
]
16+
}
17+
},
18+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
19+
}

0 commit comments

Comments
 (0)