Skip to content

Commit 1fe06ef

Browse files
committed
ci: configure release-please with PyPI trusted publishing
- release-please-config.json: bootstrap-sha, changelog-sections, extra-files - release-please.yml: full multi-platform build matrix + OIDC publish Platforms: Linux (x86_64, aarch64), macOS (x86_64, aarch64), Windows (x86_64) Requires PyPI trusted publisher configuration: - Owner: cachekit-io - Repo: cachekit-py - Workflow: release-please.yml - Environment: release
1 parent 7d20cc0 commit 1fe06ef

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
name: Release Please
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
version: ${{ steps.release.outputs.version }}
19+
steps:
20+
- name: Run release-please
21+
id: release
22+
uses: googleapis/release-please-action@v4
23+
with:
24+
manifest-file: .release-please-manifest.json
25+
config-file: release-please-config.json
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
build-wheels:
29+
name: Build wheels (${{ matrix.target }})
30+
needs: release-please
31+
if: needs.release-please.outputs.release_created == 'true'
32+
strategy:
33+
matrix:
34+
include:
35+
- os: ubuntu-latest
36+
target: x86_64-unknown-linux-gnu
37+
- os: ubuntu-latest
38+
target: aarch64-unknown-linux-gnu
39+
- os: macos-latest
40+
target: x86_64-apple-darwin
41+
- os: macos-latest
42+
target: aarch64-apple-darwin
43+
- os: windows-latest
44+
target: x86_64-pc-windows-msvc
45+
runs-on: ${{ matrix.os }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
ref: ${{ needs.release-please.outputs.tag_name }}
50+
51+
- uses: PyO3/maturin-action@v1
52+
with:
53+
target: ${{ matrix.target }}
54+
args: --release --out dist
55+
manylinux: auto
56+
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
name: wheels-${{ matrix.target }}
60+
path: dist
61+
62+
build-sdist:
63+
name: Build source distribution
64+
needs: release-please
65+
if: needs.release-please.outputs.release_created == 'true'
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
ref: ${{ needs.release-please.outputs.tag_name }}
71+
72+
- uses: PyO3/maturin-action@v1
73+
with:
74+
command: sdist
75+
args: --out dist
76+
77+
- uses: actions/upload-artifact@v4
78+
with:
79+
name: sdist
80+
path: dist
81+
82+
publish:
83+
name: Publish to PyPI
84+
needs: [release-please, build-wheels, build-sdist]
85+
runs-on: ubuntu-latest
86+
environment: release
87+
permissions:
88+
id-token: write
89+
90+
steps:
91+
- uses: actions/download-artifact@v4
92+
with:
93+
pattern: wheels-*
94+
merge-multiple: true
95+
path: dist
96+
97+
- uses: actions/download-artifact@v4
98+
with:
99+
name: sdist
100+
path: dist
101+
102+
- name: Publish to PyPI (Trusted Publishing)
103+
uses: pypa/gh-action-pypi-publish@release/v1

release-please-config.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "python",
4+
"bootstrap-sha": "7d20cc0",
5+
"changelog-sections": [
6+
{"type": "feat", "section": "Features"},
7+
{"type": "fix", "section": "Bug Fixes"},
8+
{"type": "perf", "section": "Performance Improvements"},
9+
{"type": "security", "section": "Security"},
10+
{"type": "revert", "section": "Reverts"},
11+
{"type": "docs", "section": "Documentation", "hidden": true},
12+
{"type": "chore", "section": "Miscellaneous", "hidden": true},
13+
{"type": "refactor", "section": "Code Refactoring", "hidden": true},
14+
{"type": "style", "section": "Styles", "hidden": true},
15+
{"type": "test", "section": "Tests", "hidden": true},
16+
{"type": "ci", "section": "CI/CD", "hidden": true},
17+
{"type": "build", "section": "Build System", "hidden": true}
18+
],
19+
"packages": {
20+
".": {
21+
"package-name": "cachekit",
22+
"changelog-path": "CHANGELOG.md"
23+
}
24+
},
25+
"extra-files": ["rust/Cargo.toml"]
26+
}

0 commit comments

Comments
 (0)