forked from mentat-is/gulp
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (63 loc) · 1.97 KB
/
python-package.yml
File metadata and controls
75 lines (63 loc) · 1.97 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
75
name: Python package
on:
push:
tags: ['v*', 'test-v*']
workflow_dispatch: {}
jobs:
test:
name: Test, lint and build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools_scm[toml] pytest
# TODO: write proper muty-python tests and enable this step
#- name: Run tests
# run: |
# pytest -q
- name: Build artifacts
run: |
python -m build
- name: Check package
run: |
python -m pip install twine
python -m twine check dist/*
publish:
name: Publish to PyPI
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/test-v')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install packaging dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools_scm[toml] twine
- name: Build
run: |
python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_VALERINO }}
TWINE_PASSWORD_TEST: ${{ secrets.PYPI_API_TEST_TOKEN_VALERINO }}
run: |
if [[ "${GITHUB_REF##*/}" == test-v* ]]; then
export TWINE_PASSWORD="${TWINE_PASSWORD_TEST}"
python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*
else
export TWINE_PASSWORD="${TWINE_PASSWORD}"
python -m twine upload --verbose dist/*
fi