Skip to content

Commit f107f47

Browse files
authored
Continuous deployment on release (#88)
* Add a deployment workflow * Ignore settings file
1 parent d758fe8 commit f107f47

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will upload a Python Package to PyPI 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+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release-build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Build release distributions
25+
run: |
26+
# NOTE: put your own distribution build steps here.
27+
python -m pip install build
28+
python -m build
29+
30+
- name: Upload distributions
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: release-dists
34+
path: dist/
35+
36+
pypi-publish:
37+
runs-on: ubuntu-latest
38+
needs:
39+
- release-build
40+
permissions:
41+
# IMPORTANT: this permission is mandatory for trusted publishing
42+
id-token: write
43+
44+
# Dedicated environments with protections for publishing are strongly recommended.
45+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
46+
environment:
47+
name: pypi
48+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
49+
# url: https://pypi.org/p/YOURPROJECT
50+
#
51+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
52+
# ALTERNATIVE: exactly, uncomment the following line instead:
53+
url: https://pypi.org/project/sqlalchemy_mptt/${{ github.event.release.name }}
54+
55+
steps:
56+
- name: Retrieve release distributions
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: release-dists
60+
path: dist/
61+
62+
- name: Publish release distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
packages-dir: dist/

0 commit comments

Comments
 (0)