Skip to content

Commit 8d2a3c3

Browse files
h-g-sCopilot
andcommitted
Add PyPI publish workflow triggered on version tags
Uses PyPI Trusted Publisher (OIDC) - no API token needed. Triggers on tags matching 'v*' (e.g. v1.15.0). setuptools-scm derives the package version from the tag automatically. To activate, configure a Trusted Publisher on PyPI: https://pypi.org/manage/project/mip/settings/publishing/ - Owner: coin-or - Repository: python-mip - Workflow: publish.yml - Environment: pypi Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0fdcc7c commit 8d2a3c3

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-24.04
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # needed for setuptools-scm to derive version from tags
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.13"
22+
23+
- name: Install build
24+
run: pip install build
25+
26+
- name: Build sdist and wheel
27+
run: python -m build
28+
29+
- name: Upload dist artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: dist
33+
path: dist/
34+
35+
publish:
36+
name: Publish to PyPI
37+
needs: build
38+
runs-on: ubuntu-24.04
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/mip
42+
permissions:
43+
id-token: write # required for OIDC trusted publishing
44+
45+
steps:
46+
- name: Download dist artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: dist
50+
path: dist/
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)