Skip to content

Commit cd18f14

Browse files
authored
Merge pull request #4856 from jtschladen/update-publishing-action
Move publishing action to use pypa/gh-action-pypi-publish
2 parents a7d008d + bbbb946 commit cd18f14

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed
Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This workflow will upload a Python Package using Twine when a Lemur release is created via github
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
1+
# This workflow will upload a Python Package to PyPI when a Lemur release is created via github
2+
# For more information see: https://github.com/marketplace/actions/pypi-publish
33

44
name: Publish Lemur's latest package to PyPI
55

@@ -8,34 +8,51 @@ on:
88
types: [created]
99

1010
jobs:
11-
deploy:
12-
11+
build:
12+
name: Build distribution
1313
runs-on: ubuntu-latest
14-
1514
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up Python
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: '3.x'
21-
- name: Autobump version
22-
run: |
23-
# from refs/tags/v0.8.1 get 0.8.1
24-
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
25-
PLACEHOLDER='^__version__ =.*'
26-
VERSION_FILE='lemur/__about__.py'
27-
# in case placeholder is missing, exists with code 1 and github actions aborts the build
28-
grep "$PLACEHOLDER" "$VERSION_FILE"
29-
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
30-
shell: bash
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install setuptools wheel twine
35-
- name: Build and publish
36-
env:
37-
TWINE_USERNAME: ${{ secrets.LEMUR_PYPI_API_USERNAME }}
38-
TWINE_PASSWORD: ${{ secrets.LEMUR_PYPI_API_TOKEN }}
39-
run: |
40-
python setup.py sdist bdist_wheel
41-
twine upload dist/*
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.x'
20+
- name: Autobump version
21+
run: |
22+
# from refs/tags/v0.8.1 get 0.8.1
23+
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
24+
PLACEHOLDER='^__version__ =.*'
25+
VERSION_FILE='lemur/__about__.py'
26+
# in case placeholder is missing, exists with code 1 and github actions aborts the build
27+
grep "$PLACEHOLDER" "$VERSION_FILE"
28+
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
29+
shell: bash
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install setuptools wheel
34+
- name: Build package
35+
run: |
36+
python setup.py sdist bdist_wheel
37+
- name: Store the distribution packages
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: python-package-distributions
41+
path: dist/
42+
pypi-publish:
43+
name: upload release to PyPI
44+
runs-on: ubuntu-latest
45+
environment:
46+
name: release
47+
url: https://pypi.org/p/lemur
48+
permissions:
49+
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi
50+
id-token: write
51+
steps:
52+
- name: Download all the dists
53+
uses: actions/download-artifact@v3
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
- name: Publish package distributions to PyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44
Unreleased
55
~~~~~~~~~~~~~~~~~~~~
66

7+
1.8.1 - `2024-05-20`
8+
~~~~~~~~~~~~~~~~~~~~
9+
10+
Updated deployment workflow to use `pypa/gh-action-pypi-publish`.
11+
712
1.8.0 - `2024-05-20`
813
~~~~~~~~~~~~~~~~~~~~
914

0 commit comments

Comments
 (0)