Skip to content

Commit 992fff1

Browse files
authored
Rework publish workflow for trusted publisher (#131)
1 parent a02e07c commit 992fff1

File tree

2 files changed

+23
-29
lines changed

2 files changed

+23
-29
lines changed
+23-19
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
name: Publish PyPi package
2-
1+
---
2+
name: Publish Pypi package
33
on:
44
workflow_call:
5-
65
jobs:
76
publish_to_pypi:
87
name: Publish Python 🐍 package 📦 to PyPI
98
runs-on: ubuntu-latest
9+
permissions:
10+
# This permission is required for trusted publishing.
11+
id-token: write
12+
contents: read
1013
env:
11-
PYTHONIOENCODING: "utf-8"
12-
14+
ZENML_DEBUG: 1
15+
ZENML_ANALYTICS_OPT_IN: false
16+
PYTHONIOENCODING: utf-8
1317
steps:
14-
- uses: actions/checkout@v3
15-
18+
- uses: actions/[email protected]
1619
- name: Get the version from the github tag ref
1720
id: get_version
1821
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
19-
2022
- name: Set up Python
21-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v5.0.0
2224
with:
2325
python-version: "3.8"
24-
2526
- name: Install Poetry
26-
uses: snok/install-poetry@v1
27+
uses: snok/install-poetry@v1.3.4
2728
with:
2829
virtualenvs-create: true
2930
virtualenvs-in-project: true
30-
31-
- name: publish
32-
env:
33-
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
34-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
35-
run: |
36-
if [ "$(cat src/mlstacks/VERSION)" = "$(echo ${GITHUB_REF} | sed 's|refs/tags/||g')" ];
37-
then ./scripts/publish.sh;
31+
- name: Include latest dashboard
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/[email protected]
38+
- name: Publish the package with poetry
39+
run: |-
40+
if [ "$(cat src/zenml/VERSION)" = "$(echo ${GITHUB_REF} | sed 's|refs/tags/||g')" ];
41+
then poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}';
3842
else echo "Version mismatch between src/zenml/VERSION and branch tag" && exit 1;
3943
fi

scripts/publish.sh

-10
This file was deleted.

0 commit comments

Comments
 (0)