Skip to content

Commit 0bd9ba5

Browse files
committed
WIP: pypi upload by github actions
1 parent eaed6bb commit 0bd9ba5

File tree

1 file changed

+76
-2
lines changed

1 file changed

+76
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88
branches: [ master ]
99
pull_request:
1010
branches: [ master ]
11+
tags:
12+
- ['v*']
1113

1214
jobs:
13-
build:
14-
15+
test:
1516
runs-on: ${{ matrix.os }}
1617
strategy:
1718
matrix:
@@ -49,3 +50,76 @@ jobs:
4950
run: |
5051
pip install pytest
5152
pytest
53+
54+
build-for-publish:
55+
name: Build distribution 📦
56+
runs-on: ubuntu-latest
57+
# if: "startsWith(github.ref, 'refs/tags')"
58+
needs: test
59+
steps:
60+
- uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
submodules: true
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: '3.11'
68+
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade build
72+
73+
- name: Build a source tarball and wheel
74+
run: python -m build .
75+
76+
- name: Store the distribution packages
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: python-package-distributions
80+
path: dist/
81+
82+
publish-to-pypi:
83+
name: >-
84+
Publish Python 🐍 distribution 📦 to PyPI
85+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
86+
needs:
87+
- build-for-publish
88+
runs-on: ubuntu-latest
89+
environment:
90+
name: pypi
91+
url: https://pypi.org/p/pyopenjtalk
92+
permissions:
93+
id-token: write # IMPORTANT: mandatory for trusted publishing
94+
steps:
95+
- name: Download all the dists
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: python-package-distributions
99+
path: dist/
100+
- name: Publish distribution 📦 to PyPI
101+
uses: pypa/gh-action-pypi-publish@release/v1
102+
103+
publish-to-testpypi:
104+
name: Publish Python 🐍 distribution 📦 to TestPyPI
105+
needs:
106+
- build-for-publish
107+
runs-on: ubuntu-latest
108+
109+
environment:
110+
name: testpypi
111+
url: https://test.pypi.org/p/pyopenjtalk
112+
113+
permissions:
114+
id-token: write # IMPORTANT: mandatory for trusted publishing
115+
116+
steps:
117+
- name: Download all the dists
118+
uses: actions/download-artifact@v4
119+
with:
120+
name: python-package-distributions
121+
path: dist/
122+
- name: Publish distribution 📦 to TestPyPI
123+
uses: pypa/gh-action-pypi-publish@release/v1
124+
with:
125+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)