Skip to content

Commit 81f1147

Browse files
authored
Merge pull request #240 from CSSFrancis/release07
Update: Update Github publish workflow
2 parents e0627ad + f84c00f commit 81f1147

File tree

1 file changed

+42
-35
lines changed

1 file changed

+42
-35
lines changed
Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
1-
# This workflow runs when a tagged release is created or it is triggered manually.
2-
# For more information see:
3-
# - Python docs: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
4-
# - GitHub action: https://github.com/marketplace/actions/pypi-publish
5-
# - GitHub docs: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
6-
# The source distribution (sdist) is built with the `build` package
7-
# (https://pypa-build.readthedocs.io/en/stable/index.html).
8-
# The sdist is attempted uploaded to TestPyPI and PyPI whenever the workflow is run
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
93

10-
name: Upload to PyPI
4+
name: Upload Python Package
115

126
on:
137
release:
148
types: [published]
159
workflow_dispatch:
1610

1711
jobs:
18-
deploy:
12+
Build:
1913
runs-on: ubuntu-latest
20-
environment: release
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.x"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
python -m pip install build
24+
25+
- name: Build
26+
run: |
27+
python -m build
28+
29+
- name: Upload artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
path: dist/*
33+
name: artifacts
34+
Publish:
35+
needs: [Build]
36+
name: Publish to PyPi
37+
runs-on: Ubuntu-latest
2138
permissions:
22-
# IMPORTANT: this permission is mandatory for trusted publishing
39+
# IMPORTANT: this permission is mandatory for trusted publishing
2340
id-token: write
2441
steps:
25-
- uses: actions/checkout@v4
26-
27-
- name: Set up Python
28-
uses: actions/setup-python@v5
29-
with:
30-
python-version: '3.x'
31-
32-
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install build
36-
37-
- name: Build package
38-
run: |
39-
python -m build
40-
41-
- name: Publish package to TestPyPI
42-
uses: pypa/gh-action-pypi-publish@release/v1
43-
with:
44-
repository-url: https://test.pypi.org/legacy/
45-
46-
- name: Publish package to PyPI
47-
uses: pypa/gh-action-pypi-publish@release/v1
42+
- name: Download dist
43+
uses: actions/download-artifact@v4.1.7
44+
with:
45+
name: artifacts
46+
path: dist
47+
- name: Display downloaded files
48+
run: |
49+
ls -shR
50+
working-directory: dist
51+
- name: Publish to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
with:
54+
attestations: false

0 commit comments

Comments
 (0)