Skip to content

Commit b6774de

Browse files
Maurício Moreira SoaresMaurício Moreira Soares
authored andcommitted
update worfklow
1 parent dd2e335 commit b6774de

File tree

1 file changed

+49
-26
lines changed

1 file changed

+49
-26
lines changed
Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,70 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
1+
# This workflow will upload a Python Package to PyPI when a release is created
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
33

44
# This workflow uses actions that are not certified by GitHub.
55
# They are provided by a third-party and are governed by
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Upload Python Package to test.PyPi and PyPi
9+
name: Upload Python Package
1010

1111
on:
1212
release:
1313
types: [published]
14-
branches: [ "release" ]
15-
workflow_dispatch:
1614

1715
permissions:
1816
contents: read
1917

2018
jobs:
21-
deploy:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
2228

29+
- name: Build release distributions
30+
run: |
31+
# NOTE: put your own distribution build steps here.
32+
python -m pip install build
33+
python -m build
34+
35+
- name: Upload distributions
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: release-dists
39+
path: dist/
40+
41+
pypi-publish:
2342
runs-on: ubuntu-latest
43+
needs:
44+
- release-build
45+
permissions:
46+
# IMPORTANT: this permission is mandatory for trusted publishing
47+
id-token: write
48+
49+
# Dedicated environments with protections for publishing are strongly recommended.
50+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
51+
environment:
52+
name: pypi
53+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
54+
url: https://pypi.org/p/trajpy
55+
#
56+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
57+
# ALTERNATIVE: exactly, uncomment the following line instead:
58+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
2459

2560
steps:
26-
- uses: actions/checkout@v3
27-
- name: Set up Python
28-
uses: actions/setup-python@v3
29-
with:
30-
python-version: '3.x'
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install build
35-
- name: Build package
36-
run: python -m build --sdist --wheel --outdir dist/.
37-
- name: Publish distribution 📦 to Test PyPI
38-
uses: pypa/gh-action-pypi-publish@release/v1
39-
with:
40-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
41-
repository-url: https://test.pypi.org/legacy/
42-
- name: Publish distribution 📦 to PyPI
43-
uses: pypa/gh-action-pypi-publish@release/v1
44-
with:
45-
user: __token__
46-
password: ${{ secrets.PYPI_API_TOKEN }}
61+
- name: Retrieve release distributions
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: release-dists
65+
path: dist/
4766

67+
- name: Publish release distributions to PyPI
68+
uses: pypa/gh-action-pypi-publish@release/v1
69+
with:
70+
packages-dir: dist/

0 commit comments

Comments
 (0)