Skip to content

Commit 73bf51d

Browse files
authored
CI: publish to pypi.org and github via tag, release CI part 3 (#13)
* Disable linter * Use versioneer, when the project is tagged, project version also updates see https://github.com/python-versioneer/python-versioneer * CI: publish to test.pypi.org small patch should publish to test.pypi.org first. * Remove travis test duplicate to github action * Also supports py3.9 & py3.10 * CI: publish to pypi.org and github via tag * Delete old file * require py 3.x * .yml -> .yaml * correct job commandas * set github release status to draft * tag contains 'rc' will be marked as prerelease * delete empty lines
1 parent d6a0792 commit 73bf51d

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

.github/workflows/release.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0 # Fetch all history for all tags and branches
15+
16+
- uses: actions/setup-python@v2
17+
with:
18+
python-version: "3.x"
19+
20+
- name: Install Dependencies
21+
run: python -m pip install --upgrade pip setuptools wheel
22+
23+
- name: Build sdist
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine check --strict dist/*
27+
ls -l dist
28+
29+
- name: Get Source Tarball Name
30+
id: tar
31+
run: |
32+
export type=tar
33+
export file=$(ls dist/ | grep ${type})
34+
echo "::set-output name=file::${file}"
35+
36+
- name: Get Binary Wheel Name
37+
id: whl
38+
run: |
39+
export type=whl
40+
export file=$(ls dist/ | grep ${type})
41+
echo "::set-output name=file::${file}"
42+
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
name: release
46+
path: dist/
47+
48+
outputs:
49+
tar: ${{ steps.tar.outputs.file }}
50+
whl: ${{ steps.whl.outputs.file }}
51+
52+
publish-to-github:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- uses: actions/checkout@v2
58+
with:
59+
fetch-depth: 0 # Fetch all history for all tags and branches
60+
61+
- uses: actions/download-artifact@v2
62+
with:
63+
name: release
64+
path: dist/
65+
66+
- name: List dist/ Folder
67+
run: ls dist/ -l
68+
69+
- name: Upload Release Asset to GitHub
70+
uses: softprops/action-gh-release@v1
71+
with:
72+
draft: true
73+
prerelease: ${{ contains(github.ref, 'rc') }}
74+
files: dist/${{ needs.build.outputs.tar }}
75+
76+
publish-to-pypi:
77+
needs: build
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- uses: actions/checkout@v2
82+
with:
83+
fetch-depth: 0 # Fetch all history for all tags and branches
84+
85+
- uses: actions/download-artifact@v2
86+
with:
87+
name: release
88+
path: dist/
89+
90+
- name: List dist/ Folder
91+
run: ls dist/ -l
92+
93+
- name: Publish to PyPI
94+
uses: pypa/[email protected]
95+
with:
96+
user: __token__
97+
password: ${{ secrets.PYPI_API_TOKEN }}
98+
verbose: true

0 commit comments

Comments
 (0)