Skip to content

Commit f4542dd

Browse files
committed
1 parent 2671824 commit f4542dd

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/python.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
tags:
9+
- release-*
10+
11+
jobs:
12+
build:
13+
name: Build distribution 📦
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
fetch-depth: 0
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.x"
25+
- name: Install pypa/build
26+
run: >-
27+
python3 -m
28+
pip install
29+
build
30+
--user
31+
- name: Build a binary wheel and a source tarball
32+
run: python3 -m build
33+
- name: Store the distribution packages
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: python-package-distributions
37+
path: dist/
38+
39+
publish-to-pypi:
40+
name: >-
41+
Publish Python 🐍 distribution 📦 to PyPI
42+
if: startsWith(github.ref, 'refs/tags/release-*') # only publish to PyPI on tag pushes
43+
needs:
44+
- build
45+
runs-on: ubuntu-latest
46+
environment:
47+
name: pypi
48+
url: https://pypi.org/p/python-gdsii
49+
permissions:
50+
id-token: write # IMPORTANT: mandatory for trusted publishing
51+
52+
steps:
53+
- name: Download all the dists
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: python-package-distributions
57+
path: dist/
58+
- name: Publish distribution 📦 to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
61+
publish-to-testpypi:
62+
name: Publish Python 🐍 distribution 📦 to TestPyPI
63+
needs:
64+
- build
65+
runs-on: ubuntu-latest
66+
67+
environment:
68+
name: testpypi
69+
url: https://test.pypi.org/p/python-gdsii
70+
71+
permissions:
72+
id-token: write # IMPORTANT: mandatory for trusted publishing
73+
74+
steps:
75+
- name: Download all the dists
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: python-package-distributions
79+
path: dist/
80+
- name: Publish distribution 📦 to TestPyPI
81+
uses: pypa/gh-action-pypi-publish@release/v1
82+
with:
83+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)