Skip to content

Commit b9d3e08

Browse files
authored
chore: add publish action to public pypi (#8)
#### Relevant issue or PR n/a #### Description of changes ☝️ #### Testing done n/a #### License - [x] By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license](https://pasteurlabs.github.io/tesseract-jax/LICENSE). - [x] I sign the Developer Certificate of Origin below by adding my name and email address to the `Signed-off-by` line. <details> <summary><b>Developer Certificate of Origin</b></summary> ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` </details> Signed-off-by: Dion Häfner <[email protected]>
1 parent 8185cd1 commit b9d3e08

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
- published
99

1010
jobs:
11-
release:
12-
name: "Release"
11+
build:
12+
name: "Build distribution"
1313
runs-on: '${{ matrix.os }}'
1414
strategy:
1515
matrix:
@@ -22,6 +22,7 @@ jobs:
2222
# - "3.11"
2323
# - "3.12"
2424
- "3.13"
25+
2526
steps:
2627
- name: Checkout
2728
uses: actions/checkout@v4
@@ -41,31 +42,38 @@ jobs:
4142
with:
4243
python-version: ${{ matrix.python-version }}
4344

44-
- name: Azure Login
45-
uses: azure/login@v2
46-
with:
47-
# https://github.com/azure/login/tree/v2/?tab=readme-ov-file#creds
48-
creds: |
49-
{
50-
"clientId": "${{ secrets.PL_INTERNAL_TOOLS_AZ_CLIENT_ID }}",
51-
"clientSecret": "${{ secrets.PL_INTERNAL_TOOLS_AZ_CLIENT_SECRET }}",
52-
"subscriptionId": "${{ vars.PL_INTERNAL_TOOLS_AZ_CLIENT_SUB_ID }}",
53-
"tenantId": "${{ secrets.PL_INTERNAL_TOOLS_AZ_TENANT_ID }}"
54-
}
55-
56-
- name: Get Azure token
57-
run: echo "AZ_TOKEN=$(az account get-access-token --query accessToken -o tsv)" >> $GITHUB_ENV
58-
5945
- name: Restore UV environment
6046
run: cp production.uv.lock uv.lock
6147

6248
- name: Build Package
6349
run: |
64-
uv build --index https://$AZ_TOKEN@${{vars.PL_INTERNAL_PYPI_PULL_URL_NO_PROTOCOL}}
50+
uv build
6551
66-
- name: Upload
67-
run: |
68-
uv publish dist/* \
69-
-u token_user \
70-
-p $AZ_TOKEN \
71-
--publish-url ${{vars.PL_INTERNAL_PYPI_PUSH_URL}}
52+
- name: Store the distribution packages
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
58+
publish:
59+
name: "Publish distribution"
60+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
61+
runs-on: ubuntu-latest
62+
needs: build
63+
64+
environment:
65+
name: pypi
66+
url: https://pypi.org/p/tesseract-jax
67+
68+
permissions:
69+
id-token: write
70+
71+
steps:
72+
- name: Download all the dists
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: python-package-distributions
76+
path: dist/
77+
78+
- name: Publish distribution to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)