Skip to content

Commit a431490

Browse files
authored
Update python-publish.yml
1 parent fcf70fe commit a431490

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

.github/workflows/python-publish.yml

+25-32
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
9-
name: Upload Python Package
1+
name: Publish Python Package
102

113
on:
12-
push:
13-
branches:
14-
- main
15-
16-
permissions:
17-
contents: write
4+
release:
5+
types: [created] # Trigger when a new GitHub release is created
6+
workflow_dispatch: # Allow manual triggering
187

198
jobs:
20-
deploy:
9+
build:
2110
runs-on: ubuntu-latest
11+
2212
steps:
23-
- uses: actions/checkout@v4
24-
- name: Set up Python
25-
uses: actions/setup-python@v3
26-
with:
27-
python-version: '3.x'
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install build twine
32-
- name: Build package
33-
run: python -m build
34-
- name: Publish package
35-
env:
36-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
37-
run: |
38-
python -m twine upload --username=__token__ --password=$PYPI_API_TOKEN --repository=smartloop dist/*
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install build tools
22+
run: python -m pip install --upgrade build twine
23+
24+
- name: Build package
25+
run: python -m build
26+
27+
- name: Publish to PyPI
28+
env:
29+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
30+
run: |
31+
python -m twine upload --username __token__ --password $PYPI_API_TOKEN dist/*

0 commit comments

Comments
 (0)