Skip to content

Commit bda300f

Browse files
author
Songki Choi
committed
Add PyPI publish workflow (#15)
1 parent 8452407 commit bda300f

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

.github/workflows/publish.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_dispatch: # run on request (no need for PR)
5+
push:
6+
tags:
7+
- '*'
8+
9+
# Declare default permissions as read only.
10+
permissions: read-all
11+
12+
jobs:
13+
Build-Packages:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
18+
- name: Set up Python
19+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
20+
with:
21+
python-version: "3.10"
22+
- name: Install pypa/build
23+
run: python -m pip install --upgrade build
24+
- name: Build packages
25+
run: python -m build
26+
- name: Upload artifacts
27+
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
28+
with:
29+
name: packages
30+
path: dist/*
31+
32+
Publish-Packages:
33+
needs: Build-Packages
34+
environment: pypi
35+
runs-on: ubuntu-latest
36+
permissions:
37+
packages: write
38+
contents: write
39+
id-token: write
40+
steps:
41+
- name: Download artifacts
42+
uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3
43+
with:
44+
path: dist
45+
pattern: packages*
46+
merge-multiple: true
47+
# Determine where to publish the package distribution to PyPI or TestPyPI
48+
- name: Check tag
49+
id: check-tag
50+
uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2
51+
with:
52+
text: ${{ github.ref }}
53+
regex: '^refs/tags/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+rc[0-9]+|rc[0-9]+)?$'
54+
- name: Upload packages to GitHub
55+
if: ${{ steps.check-tag.outputs.match != '' }}
56+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
57+
with:
58+
repo_token: ${{ secrets.GITHUB_TOKEN }}
59+
file: dist/*
60+
tag: ${{ github.ref }}
61+
overwrite: true
62+
file_glob: true
63+
- name: Publish packages to PyPI
64+
if: ${{ steps.check-tag.outputs.match != '' }}
65+
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 # v1.8.12
66+
- name: Publish packages to TestPyPI
67+
if: ${{ steps.check-tag.outputs.match == '' }}
68+
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 # v1.8.12
69+
with:
70+
repository-url: https://test.pypi.org/legacy/
71+
verbose: true

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "openvino_xai"
10-
version = "1.0.0rc0"
10+
version = "1.0.0rc01"
1111
dependencies = [
1212
"openvino-dev==2023.2",
1313
"opencv-python",
@@ -26,7 +26,7 @@ readme = "README.md"
2626
license = {file = "LICENSE"}
2727
keywords = ["openvino-toolkit", "explainable-ai", "xai", "cnn", "transformer", "black-box", "white-box"]
2828
classifiers = [
29-
"License :: OSI Approved :: MIT Apache Software License",
29+
"License :: OSI Approved :: Apache Software License",
3030
"Programming Language :: Python :: 3.10",
3131
"Programming Language :: Python :: 3.11",
3232
]

0 commit comments

Comments
 (0)