-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (42 loc) · 1.55 KB
/
FEZrs_PyPI_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
name: PyPI Publish with License Update
on:
push:
branches:
- main # Trigger on push to main (i.e., after PR merge)
jobs:
update-license-and-publish:
runs-on: ubuntu-latest
environment: fezrs
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Update setup.py with new license
run: |
sed -i 's/license="MIT"/license="Apache 2.0"/g' setup.py
sed -i 's/"License :: OSI Approved :: MIT License"/"License :: OSI Approved :: Apache Software License"/g' setup.py
- name: Automatically bump version in setup.py
run: |
VERSION=$(python setup.py --version)
echo "Current version is $VERSION"
# Increment the version number (for example, bump the minor version)
NEW_VERSION=$(echo $VERSION | awk -F. -v OFS=. '{$NF++;print}')
echo "New version is $NEW_VERSION"
# Update the version in setup.py
sed -i "s/version=\"$VERSION\"/version=\"$NEW_VERSION\"/" setup.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*