Skip to content

Commit 238ec2b

Browse files
committed
Test build [cd build]
1 parent ff6287f commit 238ec2b

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
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

66
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
713
release:
8-
types: [created]
14+
types: [published]
915

1016
jobs:
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"]
@@ -34,8 +41,25 @@ jobs:
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__

0 commit comments

Comments
 (0)