Skip to content

Commit 34850a4

Browse files
committed
CI: add a job for trusted publishing when pushing a tag
1 parent 0444e63 commit 34850a4

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-FileCopyrightText: 2025 The meson-python developers
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Release
6+
on:
7+
push:
8+
tags:
9+
- "*"
10+
branches:
11+
- main
12+
- release-*
13+
pull_request:
14+
branches:
15+
- main
16+
- release-*
17+
18+
jobs:
19+
build-artifacts:
20+
name: Build sdist and wheel
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
26+
- name: Setup Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: 3.14
30+
31+
- name: Install pypa/build
32+
run: |
33+
python -m pip install build
34+
35+
- name: Run pypa/build
36+
run: |
37+
python -m build
38+
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
path: ./dist/meson_python-*
42+
43+
pypi-publish:
44+
name: Upload release to PyPI
45+
runs-on: ubuntu-latest
46+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
47+
environment:
48+
name: pypi
49+
url: https://pypi.org/p/meson-python
50+
permissions:
51+
id-token: write
52+
steps:
53+
- name: Download sdist and wheel
54+
uses: actions/download-artifact@v5
55+
with:
56+
path: dist
57+
merge-multiple: true
58+
59+
- name: Publish package distributions to PyPI
60+
uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
print-hash: true

0 commit comments

Comments
 (0)