Skip to content

Commit cfdd025

Browse files
author
Anze
committed
Github Actions
1 parent dfe21d1 commit cfdd025

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/on_release.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Checkout source code
14+
uses: actions/checkout@v1
15+
16+
17+
- name: Use Python 3
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: '3.6'
21+
architecture: 'x64'
22+
23+
24+
- name: Deploy to PyPi
25+
if: success() && startsWith(github.ref, 'refs/tags/v')
26+
env:
27+
GITHUB_REF_TAG: ${{ github.ref }}
28+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
29+
run: |
30+
export VERSION=${GITHUB_REF_TAG:10:50}
31+
echo "Version is $VERSION"
32+
pip install --no-cache-dir twine pipenv wheel
33+
sed -i "s/@@VERSION@@/$CI_COMMIT_TAG/g" ./setup.py
34+
pipenv lock -r > requirements.txt
35+
python setup.py install
36+
python setup.py sdist
37+
python setup.py bdist_wheel
38+
twine upload -r pypi -u __token__ -p "${PYPI_TOKEN}" dist/*

0 commit comments

Comments
 (0)