generated from leonhma/python-package-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.46 KB
/
release.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
name: release
on:
release:
types: [ published ]
jobs:
release:
runs-on: ubuntu-latest
env:
PYPI_PASSWD: ${{ secrets.PYPI_PASSWD }}
TEST_PYPI_PASSWD: ${{ secrets.TEST_PYPI_PASSWD }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Modify setup.py version
run: |
sed -i -E 's|version=\".*?\"|version="${{ github.event.release.tag_name }}"|g' setup.py
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Upload release assets
uses: AButler/[email protected]
with:
files: dist/*
repo-token: ${{ secrets.GITHUB_TOKEN }}
permissions: write-all
release-tag: ${{ github.event.release.tag_name }}
- name: Publish to test-pypi
if: env.TEST_PYPI_PASSWD != ''
run: |
twine upload dist/* --repository testpypi -u __token__ -p ${{ secrets.TEST_PYPI_PASSWD }} --non-interactive --disable-progress-bar -c "${{ github.event.release.body }}"
- name: Publish to pypi
if: "!github.event.release.prerelease && env.PYPI_PASSWD != ''"
run: |
twine upload dist/* --repository pypi -u __token__ -p ${{ secrets.PYPI_PASSWD }} --non-interactive --disable-progress-bar -c "${{ github.event.release.body }}"