forked from detule/odbc-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.07 KB
/
publish.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
name: odbcli
on: push
jobs:
build-n-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: "3.7"
- name: Update dev version
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags') != true
run: |
sed -i "/__version__ = / s/\"$/.20${{github.run_number}}\"/" odbcli/__init__.py
- name: Build and test
run: |
python -m pip install --upgrade --upgrade-strategy eager . twine pytest
pytest .
python setup.py sdist -d dist/
- name: Publish to Test PyPI
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}