Skip to content

Commit 9f22adb

Browse files
authored
MAINT: Use PyPI upload action for published releases (mne-tools#12037)
1 parent d52a0d3 commit 9f22adb

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Upload a Python Package using Twine when a release is created
2+
3+
name: Build
4+
on: # yamllint disable-line rule:truthy
5+
release:
6+
types: [published]
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
package:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.10'
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build twine
29+
- run: python -m build --sdist --wheel
30+
- run: twine check --strict dist/*
31+
- uses: actions/upload-artifact@v3
32+
with:
33+
name: dist
34+
path: dist
35+
36+
pypi-upload:
37+
needs: package
38+
runs-on: ubuntu-latest
39+
if: github.event_name == 'release'
40+
permissions:
41+
id-token: write # for trusted publishing
42+
environment:
43+
name: pypi
44+
url: https://pypi.org/p/mne
45+
steps:
46+
- uses: actions/download-artifact@v3
47+
with:
48+
name: dist
49+
path: dist
50+
- uses: pypa/gh-action-pypi-publish@release/v1
51+
if: github.event_name == 'release'

0 commit comments

Comments
 (0)