Skip to content

Commit fbeb48d

Browse files
author
Carlos Kidman
committed
Update publish yml to use pypi's new method
1 parent 090c735 commit fbeb48d

File tree

1 file changed

+19
-39
lines changed

1 file changed

+19
-39
lines changed
Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,34 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Upload Pylenium Package
1+
name: Upload Pylenium Package to pypi
52

63
on:
74
release:
85
types: [created]
96
workflow_dispatch:
107
inputs:
11-
version:
12-
description: 'The version to publish to pypi'
13-
required: true
14-
default: 'develop'
8+
version: # keeping this for eventaul autobump feature
9+
description: "The version to publish to pypi"
10+
required: false
11+
default: "develop"
1512

1613
jobs:
17-
deploy:
14+
pypi-publish:
15+
name: upload release to PyPI
1816
runs-on: ubuntu-latest
19-
17+
permissions:
18+
# IMPORTANT: this permission is mandatory for trusted publishing
19+
id-token: write
2020
steps:
2121
- uses: actions/checkout@v2
22-
-
23-
name: Set up Python
22+
23+
- name: Set up Python
2424
uses: actions/setup-python@v2
2525
with:
2626
python-version: "3.x"
27-
-
28-
name: Autobump version
29-
run: |
30-
# from refs/tags/v1.2.3 get 1.2.3
31-
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
32-
PLACEHOLDER='__version__ = "develop"'
33-
VERSION_FILE='pylenium/__init__.py'
34-
# ensure the placeholder is there. If grep doesn't find the placeholder
35-
# it exits with exit code 1 and github actions aborts the build.
36-
grep "$PLACEHOLDER" "$VERSION_FILE"
37-
if [ ${{ github.event.inputs.version }} != "develop" ]; then
38-
VERSION=${{ github.event.inputs.version }}
39-
fi
40-
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
41-
shell: bash
42-
-
43-
name: Install dependencies
44-
run: |
45-
python -m pip install --upgrade pip
46-
pip install setuptools wheel twine
47-
-
48-
name: Build and publish
49-
env:
50-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
51-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
27+
28+
- name: Build distributions
5229
run: |
53-
python setup.py sdist bdist_wheel
54-
twine upload dist/*
30+
pip install poetry
31+
poetry build
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)