-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (59 loc) · 1.6 KB
/
Copy pathpython-package.yml
File metadata and controls
74 lines (59 loc) · 1.6 KB
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
name: Python Package CD
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'docs/**'
permissions:
contents: write
id-token: write
# todo:
# - remove test/lint (already in feature pipelines)
# - 3jobs: bump/package/publish
# -
# -
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: true
ref: main
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# lint and unit tests
- name: Run unit tests
run: python -m unittest discover -s tests -p 'test_*.py'
- name: Run Ruff
run: ruff check --output-format=github src
# version increment
- name: Set up Git user for bump2version commit
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Bump version and push tag
run: |
pip install --upgrade bump2version
bump2version patch --allow-dirty
- name: Push version bump to main
run: |
git push origin HEAD:main --tags
# build package
- name: Build Python package
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}