-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (64 loc) · 2.03 KB
/
python-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
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
name: Publish
on:
release:
types: [created]
push:
branches: [dev]
pull_request:
branches: [master]
create:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest setuptools wheel twine build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Get release version
id: get_version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
echo "Release version: $VERSION"
echo ::set-output name=VERSION::$VERSION
else
echo "Not a release tag. Exiting."
exit 1
fi
- name: Update setup.py version
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
sed -i "s/version='0.0.0'/version='$VERSION'/" setup.py
- name: Build and test
run: |
python -m build
pip install dist/article_parser-*.whl
pytest --disable-warnings
# - name: Test Publish
# uses: pypa/gh-action-pypi-publish@release/v1
# if: github.event_name == 'release' && github.event.action == 'created'
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
# skip-existing: true
# verbose: true
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verbose: true