Skip to content

Commit 5fdddaa

Browse files
committed
Create publish.yml
1 parent 930544b commit 5fdddaa

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
# setuptools_scm derives the version from git tags and history.
16+
fetch-depth: 0
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
- name: Build sdist and wheel
21+
run: |
22+
python -m pip install --upgrade build
23+
python -m build
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: dist
27+
path: dist/
28+
29+
publish:
30+
name: Publish to PyPI
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/p/hardwarelibrary
36+
permissions:
37+
# Required for Trusted Publishing (OIDC); no API token needed.
38+
id-token: write
39+
steps:
40+
- uses: actions/download-artifact@v4
41+
with:
42+
name: dist
43+
path: dist/
44+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)