-
Notifications
You must be signed in to change notification settings - Fork 61
71 lines (64 loc) · 2.34 KB
/
Copy pathpython-package.yml
File metadata and controls
71 lines (64 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
run-name: Package and Publish
on:
workflow_run:
workflows:
- "Python lint"
types:
- completed
branches:
- main
jobs:
release-build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && !startsWith(github.ref_name, 'docs?/') }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: Upload distributions
# Make sure the artifact versions match
uses: actions/upload-artifact@v4
with:
# Name of the distribution (no idea why they don't make this clear)
name: pywebpush
path: dist/*.tar.gz
pypi-publish:
# Remember, matching strings need to be in single quotes.
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
runs-on: ubuntu-latest
# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi-publish
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
url: https://pypi.org/p/pywebpush
steps:
- name: Pull release distributions
# Make sure the artifact versions match
uses: actions/download-artifact@v8
with:
# Name of the distribution (no idea why they don't make this clear)
name: pywebpush
path: dist/
- name: validate build
run: |
ls -aFl dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
#with:
# packages-dir: dist/
# verbose: true