File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed
Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: 2016-2024 PyThaiNLP Project
22# SPDX-License-Identifier: CC0-1.0
33
4- name : Upload package to PyPI
4+ name : Build and publish to PyPI
55
66on :
7+ push :
8+ branches :
9+ - main
10+ pull_request :
11+ branches :
12+ - main
713 release :
8- types : [created ]
14+ types : [published ]
915
1016jobs :
11- pypi-publish :
12-
17+ build :
18+ name : Build and check distributions
1319 runs-on : ubuntu-latest
20+ if : contains(github.event.head_commit.message, '[cd build]')
1421 strategy :
1522 matrix :
1623 python-version : ["3.12"]
3441 - name : Check distributions
3542 run : twine check dist/*
3643
44+ - name : Store distributions
45+ uses : actions/upload-artifact@v3
46+ with :
47+ path : pythainlp/dist/*
48+
49+ publish_pypi :
50+ name : Publish to PyPI
51+ runs-on : ubuntu-latest
52+ needs : [build]
53+ if : github.event_name == 'release' && github.event.action == 'published'
54+ steps :
55+ - name : Retrieve distributions
56+ uses : actions/download-artifact@v3
57+ with :
58+ name : artifact
59+ path : dist
3760 - name : Publish to PyPI
3861 uses : pypa/gh-action-pypi-publish@release/v1
62+ if : github.event_name == 'release' && github.event.action == 'published'
3963 with :
4064 skip-existing : true
4165 user : __token__
You can’t perform that action at this time.
0 commit comments