Skip to content

Commit 90a3650

Browse files
authored
[action] Add a workflow for publishing official package (#168)
* [action] Add a workflow for publishing official package This commit adds a workflow that publishes official pakcage. TICO-DCO-1.0-Signed-off-by: seongwoo <[email protected]>
1 parent e5d260d commit 90a3650

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish Official Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref_name:
7+
description: 'Git reference (branch or tag) to build and publish'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build-and-upload:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout the specified ref
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ inputs.ref_name }}
20+
21+
# Verify version consistency between tag and version.py
22+
- name: Check version.py matches ref_name
23+
run: |
24+
FILE_VERSION=$(python -c 'exec(open("version.py").read()); print(VERSION)')
25+
INPUT_REF="${{ inputs.ref_name }}"
26+
TAG_VERSION="${INPUT_REF#v}" # Strip leading 'v' from ref_name
27+
28+
echo "VERSION in version.py: $FILE_VERSION"
29+
echo "VERSION from ref_name: $TAG_VERSION"
30+
31+
if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then
32+
echo "::error::VERSION in version.py ($FILE_VERSION) does not match ref_name ($INPUT_REF)"
33+
exit 1
34+
fi
35+
36+
- name: "Build package"
37+
run: |
38+
./ccex build
39+
40+
- name: "Upload artifact"
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: "wheel"
44+
path: "./dist/"
45+
46+
publish-to-pypi:
47+
needs:
48+
- build-and-upload
49+
runs-on: ubuntu-22.04
50+
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/p/TICO
54+
55+
permissions:
56+
id-token: write # IMPORTANT: mandatory for trusted publishing
57+
58+
steps:
59+
- name: "Download all the dists"
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: "wheel"
63+
path: "./dist/"
64+
65+
- name: "Publish distribution to PyPI"
66+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)