Skip to content

Commit 1bfcbb2

Browse files
add pypi/test-pypi deploy action
1 parent 7fc6447 commit 1bfcbb2

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
build:
13+
if: github.repository == 'pytest-dev/apipkg'
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- run: |
19+
git fetch --prune --unshallow
20+
21+
- name: Cache
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.cache/pip
25+
key: deploy-${{ hashFiles('**/setup.cfg') }}
26+
restore-keys: |
27+
deploy-
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 3.9
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install -U pip
37+
python -m pip install -U setuptools setuptools_scm twine wheel
38+
39+
- name: Build package
40+
run: |
41+
git tag
42+
python setup.py --version
43+
python setup.py sdist --format=gztar bdist_wheel
44+
twine check dist/*
45+
46+
- name: Publish package to PyPI
47+
if: github.event.action == 'published'
48+
uses: pypa/gh-action-pypi-publish@master
49+
with:
50+
user: __token__
51+
password: ${{ secrets.pypi_token }}
52+
53+
- name: Publish package to TestPyPI
54+
uses: pypa/gh-action-pypi-publish@master
55+
with:
56+
user: __token__
57+
password: ${{ secrets.test_pypi_token }}
58+
repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)