-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.36 KB
/
publish.yml
File metadata and controls
48 lines (40 loc) · 1.36 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
name: Publish to PyPI
# Publishes the PytorchWildlife package to PyPI when a GitHub Release is published.
# Uses PyPI Trusted Publishing (OIDC) -- no API token or stored secret is required.
#
# One-time maintainer setup (PyPI project owner, account-side):
# PyPI -> project "PytorchWildlife" -> Manage -> Publishing -> Add a trusted publisher (GitHub Actions):
# Owner: microsoft
# Repository: Pytorch-Wildlife
# Workflow: publish.yml
# Environment: pypi
# After that, publishing a GitHub Release runs this workflow and uploads the build.
on:
release:
types: [published]
permissions:
contents: read
jobs:
build-and-publish:
name: Build and publish PytorchWildlife
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/PytorchWildlife/
permissions:
id-token: write # required for Trusted Publishing (OIDC)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build sdist and wheel
run: |
python -m pip install --upgrade build
python -m build
- name: Check distribution metadata
run: |
python -m pip install --upgrade twine
python -m twine check dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1