-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enablei Github release as pypi CD trigger
- Loading branch information
1 parent
343d6fb
commit b0836bb
Showing
1 changed file
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
--- | ||
name: cd-pypi | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
deploy: | ||
if: ${{ github.ref_type == 'tag' }} | ||
if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine build | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine build | ||
- name: Check version | ||
run: | | ||
if [ -f "setup.py" ]; then | ||
release=${{ github.ref_name }} | ||
version=$(python setup.py --version) | ||
test "$release" == "$version" | ||
fi | ||
- name: Check version | ||
run: | | ||
if [ -f "setup.py" ]; then | ||
release=${{ github.ref_name }} | ||
version=$(python setup.py --version) | ||
test "$release" == "$version" | ||
fi | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
python -m build | ||
twine upload dist/* | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
python -m build | ||
twine upload dist/* |