Skip to content

Commit 1d66a1f

Browse files
authored
ci: integrate release-please action (#116)
* ci: integrate release-please action Adopt release-please for automated versioning and releases, modeled on the hub-seeder setup and adapted for Python/Poetry/PyPI. - Add release-please-config.json (release-type: python, v-prefixed tags, bump-minor-pre-major) and bootstrap .release-please-manifest.json to the current version 0.2.16 to align with existing v* tags. - Add release.yml that runs release-please on pushes to main and, once a release is created, builds the package, publishes to PyPI via trusted publishing, and deploys the Sphinx docs. - Remove publish.yml and sphinx.yml; their tag-triggered jobs are folded into release.yml since tags created with GITHUB_TOKEN do not trigger separate workflows. * ci: gate publish job explicitly on releases_created
1 parent b425f76 commit 1d66a1f

5 files changed

Lines changed: 98 additions & 70 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
release-please:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
releases_created: ${{ steps.release.outputs.releases_created }}
20+
steps:
21+
- name: Release Please
22+
id: release
23+
uses: googleapis/release-please-action@v5
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
build:
28+
runs-on: ubuntu-latest
29+
needs: release-please
30+
if: needs.release-please.outputs.releases_created == 'true'
31+
steps:
32+
- uses: actions/checkout@v6
33+
- name: Set up Poetry
34+
uses: ./.github/actions/setup-poetry
35+
- name: Install dependencies
36+
run: poetry install
37+
- name: Build package
38+
run: poetry build --no-interaction
39+
- name: Upload build artifact
40+
uses: actions/upload-artifact@v7
41+
with:
42+
path: dist/
43+
name: package-dist
44+
45+
publish:
46+
runs-on: ubuntu-latest
47+
needs: [release-please, build]
48+
if: needs.release-please.outputs.releases_created == 'true'
49+
environment: pypi
50+
permissions:
51+
id-token: write
52+
steps:
53+
- name: Download build artifact
54+
uses: actions/download-artifact@v8
55+
with:
56+
path: ${{ github.workspace }}/dist/
57+
name: package-dist
58+
- name: Publish to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
61+
docs:
62+
runs-on: ubuntu-latest
63+
needs: release-please
64+
if: needs.release-please.outputs.releases_created == 'true'
65+
permissions:
66+
contents: write
67+
steps:
68+
- uses: actions/checkout@v6
69+
with:
70+
persist-credentials: false
71+
- name: Set up Poetry
72+
uses: ./.github/actions/setup-poetry
73+
- name: Install dependencies
74+
run: poetry install --with docs
75+
- name: Build HTML
76+
run: poetry run make -C docs/ html
77+
- name: Upload artifacts
78+
uses: actions/upload-artifact@v7
79+
with:
80+
name: html-docs
81+
path: docs/_build/html
82+
- name: Deploy
83+
uses: peaceiris/actions-gh-pages@v4
84+
with:
85+
github_token: ${{ secrets.GITHUB_TOKEN }}
86+
publish_dir: docs/_build/html

.github/workflows/sphinx.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.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.16"
3+
}

release-please-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"release-type": "python",
3+
"include-component-in-tag": false,
4+
"include-v-in-tag": true,
5+
"bump-minor-pre-major": true,
6+
"packages": {
7+
".": {}
8+
}
9+
}

0 commit comments

Comments
 (0)