Repository navigation
75 lines (69 loc) · 2.41 KB
/
Copy pathpython-publish.yml
File metadata and controls
75 lines (69 loc) · 2.41 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
72
73
74
75
# Publishing is intentionally disabled. Remove the false job guards only after
# configuring the protected "pypi" environment and a PyPI trusted publisher for
# microsoft/msticpy, python-publish.yml, and the "pypi" environment.
# The environment must require approval and restrict deployments to release tags.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package to PyPI Prod
on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
if: >-
${{ false && github.event_name == 'release' &&
!github.event.release.prerelease && startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Upload distributions
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: python-distributions
path: dist/
if-no-files-found: error
retention-days: 1
publish:
needs: build
if: >-
${{ false && needs.build.result == 'success' &&
github.event_name == 'release' && !github.event.release.prerelease &&
startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/msticpy
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: python-distributions
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2