-
Notifications
You must be signed in to change notification settings - Fork 46
46 lines (38 loc) · 1.38 KB
/
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
# Builds mhkit and publishes to testpypi.org on every commit to main. On tagged commits, also publishes to pypi.org.
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Build and release 🐍 📦
on:
push:
branches:
- main
release:
types: [published]
jobs:
build-and-publish:
name: Build and release 🐍 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python -m pip install build --user
- run: python -m build --sdist --wheel --outdir dist/ .
- name: Upload to Test PyPI
if: github.event_name != 'release' && github.repository_owner == 'MHKiT-Software'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Upload to PyPI (tagged release only)
if:
github.repository_owner == 'MHKiT-Software' && github.event_name == 'release' &&
github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}