-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 1.79 KB
/
publish_package_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
name: Publish to PyPi
on:
release:
types:
- published
push:
branches:
- main
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- name: Ruff Linting
uses: chartboost/ruff-action@v1
with:
version: 0.0.289
- name: Black Format Check
uses: psf/black@stable
with:
options: "--check"
src: "."
jupyter: false
version: "~= 23.3" # this is the version that ships with the vs code extension, currently
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install multidms
run: |
pip install -e ".[dev]"
- name: Test
run: |
pytest
- name: Build python package
run: |
python -m pip install build
python -m build --wheel
# if you push with a new tag using bumpver,
# then we publish to test PyPI
- name: Publish package distributions to TestPyPI
if: ${{ github.event_name == 'push' && startsWith(github.event.head_commit.message, 'bump version') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# only publish and update to PyPI if you cut a new release
- name: Publish package
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1