Skip to content

Commit cadebd8

Browse files
authored
update workflow (SalesforceAIResearch#160)
Add a workflow to manually publish to pypi
1 parent fdcb656 commit cadebd8

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

.github/workflows/pypi_publish.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ jobs:
5555
- name: Verify Test PyPI publication
5656
run: |
5757
sleep 60
58-
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ uni2ts==${GITHUB_REF#refs/tags/v}
58+
# Extract version from tag
59+
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
60+
echo "Installing version: $VERSION"
61+
pip install --index-url https://test.pypi.org/simple/ uni2ts==${VERSION}
5962
python -c "import uni2ts; print(uni2ts.__version__)"
6063
6164
publish-prod:
@@ -90,5 +93,8 @@ jobs:
9093
- name: Verify PyPI publication
9194
run: |
9295
sleep 60
93-
pip install uni2ts==${GITHUB_REF#refs/tags/v}
96+
# Extract version from tag
97+
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
98+
echo "Installing version: $VERSION"
99+
pip install uni2ts==$VERSION
94100
python -c "import uni2ts; print(uni2ts.__version__)"
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will upload a Python Package using Twine to Test PyPi (Full release) when a workflow_dispatch event is triggered.
2+
3+
name: Manually Publish Package
4+
5+
on: workflow_dispatch
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Install tools
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install hatch twine
24+
25+
- name: Build package
26+
run: |
27+
hatch build
28+
29+
- name: Run package validators
30+
run: |
31+
twine check dist/*
32+
33+
# Test install from wheel
34+
pip install dist/*.whl
35+
python -c "import uni2ts; print(uni2ts.__version__)"
36+
37+
- name: Upload to PyPI
38+
env:
39+
TWINE_USERNAME: __token__
40+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
41+
run: |
42+
twine upload --verbose dist/*
43+
44+
- name: Verify PyPI publication
45+
run: |
46+
sleep 60
47+
# Extract version from tag
48+
VERSION=${GITHUB_REF#refs/tags/} # removes refs/tags/
49+
echo "Installing version: $VERSION"
50+
pip install uni2ts==$VERSION
51+
python -c "import uni2ts; print(uni2ts.__version__)"

0 commit comments

Comments
 (0)