|
| 1 | +--- |
1 | 2 | name: Publish Pypi package
|
2 |
| - |
3 | 3 | on:
|
4 | 4 | workflow_call:
|
5 |
| - |
6 | 5 | jobs:
|
7 | 6 | publish_to_pypi:
|
8 | 7 | name: Publish Python 🐍 package 📦 to PyPI
|
9 | 8 | runs-on: ubuntu-latest
|
| 9 | + permissions: |
| 10 | + # This permission is required for trusted publishing. |
| 11 | + id-token: write |
| 12 | + contents: read |
10 | 13 | env:
|
11 | 14 | ZENML_DEBUG: 1
|
12 | 15 | ZENML_ANALYTICS_OPT_IN: false
|
13 |
| - PYTHONIOENCODING: 'utf-8' |
14 |
| - |
| 16 | + PYTHONIOENCODING: utf-8 |
15 | 17 | steps:
|
16 |
| - - uses: actions/checkout@v3 |
17 |
| - |
| 18 | + - uses: actions/checkout@v4.1.1 |
18 | 19 | - name: Get the version from the github tag ref
|
19 | 20 | id: get_version
|
20 | 21 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
21 |
| - |
22 | 22 | - name: Set up Python
|
23 |
| - uses: actions/setup-python@v2 |
| 23 | + uses: actions/setup-python@v5.0.0 |
24 | 24 | with:
|
25 | 25 | python-version: '3.8'
|
26 |
| - |
27 | 26 | - name: Install Poetry
|
28 |
| - uses: snok/install-poetry@v1 |
| 27 | + uses: snok/install-poetry@v1.3.4 |
29 | 28 | with:
|
30 | 29 | virtualenvs-create: true
|
31 | 30 | virtualenvs-in-project: true
|
32 |
| - |
33 | 31 | - name: Include latest dashboard
|
34 |
| - shell: bash |
35 |
| - env: |
36 |
| - TAG: v0.9.0 |
37 |
| - run: scripts/install-dashboard.sh |
38 |
| - |
39 |
| - - name: publish |
40 |
| - env: |
41 |
| - PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} |
42 |
| - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
43 |
| - run: | |
| 32 | + run: bash scripts/install-dashboard.sh |
| 33 | + - name: Build package |
| 34 | + run: poetry build |
| 35 | + - name: Mint token |
| 36 | + id: mint |
| 37 | + uses: tschm/token-mint-action@v1.0.2 |
| 38 | + - name: Publish the package with poetry |
| 39 | + run: |- |
44 | 40 | if [ "$(cat src/zenml/VERSION)" = "$(echo ${GITHUB_REF} | sed 's|refs/tags/||g')" ];
|
45 |
| - then ./scripts/publish.sh; |
| 41 | + then poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}'; |
46 | 42 | else echo "Version mismatch between src/zenml/VERSION and branch tag" && exit 1;
|
47 | 43 | fi
|
48 |
| -
|
0 commit comments