-
Notifications
You must be signed in to change notification settings - Fork 16
76 lines (72 loc) · 2.3 KB
/
publish_to_pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Build and publish to TestPyPI or PyPI
on: [push, pull_request]
jobs:
get_python_versions:
name: "Determine Python versions"
runs-on: ubuntu-latest
outputs:
min-python: ${{ steps.nep29.outputs.min-python }}
max-python: ${{ steps.nep29.outputs.max-python }}
steps:
- name: "calculate versions according to NEP29"
id: nep29
uses: mstimberg/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: [get_python_versions]
name: Build 🎡 and source 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we need the full history for the version calculation
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build source tarball and noarch wheel
run: |
python -m pip install --upgrade pip build wheel
python -m build
- name: store distribution 📦
uses: actions/upload-artifact@v4
with:
name: packages
path: dist
deploy_dev:
name: Publish development 📦 to TestPyPI
runs-on: ubuntu-latest
if: github.repository == 'brian-team/brian2genn' && github.ref == 'refs/heads/master'
environment: development_release
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
needs:
- build
steps:
- name: load distribution 📦
uses: actions/download-artifact@v4
with:
name: packages
path: dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
deploy:
name: Publish release 📦 to PyPI
runs-on: ubuntu-latest
if: github.repository == 'brian-team/brian2genn' && startsWith(github.ref, 'refs/tags')
environment: release
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
needs:
- build
steps:
- name: load distribution 📦
uses: actions/download-artifact@v4
with:
name: packages
path: dist/
- name: Publish distribution release 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1