forked from zenml-io/mlstacks
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (41 loc) · 1.31 KB
/
publish-pypi-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
name: Publish Pypi package
on:
workflow_call:
jobs:
publish_to_pypi:
name: Publish Python 🐍 package 📦 to PyPI
runs-on: ubuntu-latest
permissions:
# This permission is required for trusted publishing.
id-token: write
contents: read
env:
ZENML_DEBUG: 1
ZENML_ANALYTICS_OPT_IN: false
PYTHONIOENCODING: utf-8
steps:
- uses: actions/checkout@v4.1.1
- name: Get the version from the github tag ref
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: "3.8"
- name: Install Poetry
uses: snok/install-poetry@v1.3.4
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Build package
run: poetry build
- name: Mint token
id: mint
uses: tschm/token-mint-action@v1.0.2
- name: Publish the package with poetry
run: |-
if [ "$(cat src/mlstacks/VERSION)" = "$(echo ${GITHUB_REF} | sed 's|refs/tags/||g')" ];
then poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}';
else echo "Version mismatch between src/mlstacks/VERSION and branch tag" && exit 1;
fi