-
Notifications
You must be signed in to change notification settings - Fork 25
81 lines (67 loc) · 2.22 KB
/
build-package.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build and publish package
on:
workflow_call: # Make workflow reusable
inputs:
enable_dev_dependencies:
required: false
type: string
runner:
required: true
type: string
secrets:
PYPI_HOST:
required: true
env:
PYPI_HOST: ${{ secrets.PYPI_HOST }}
ENABLE_DEV_DEPENDENCIES: ${{ inputs.enable_dev_dependencies }}
permissions:
contents: read
jobs:
build_sdk:
runs-on: ${{ inputs.runner }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- name: Checkout code with caching for Git LFS
uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2 # v1.2.3
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: 3.12
- name: Install package with dev and notebook requirements
run: |
python -m pip install --upgrade pip
if [[ $ENABLE_DEV_DEPENDENCIES = 1 ]]; then
pip install ".[dev,notebooks]" --pre
else
pip install ".[dev,notebooks]"
fi
- name: Install build tools
run: pip install build twine
- name: Build package
run: python -m build
- name: Check package contents
run: twine check dist/*
- name: Upload wheel and source files as github artifact
# Publish the built wheel and source tarball to github
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: ${{ always() }}
with:
name: geti_sdk
path: dist
- name: Publish SDK package to pypi
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
if: ${{ PYPI_HOST == 'test.pypi.org' }}
with:
repository-url: https://test.pypi.org/
verbose: true
- name: Clean up dist directory if it was created
if: ${{ always() }}
run: |
if OUTPUT=$(ls | grep -c dist)
then
echo "Cleaning up dist directory"
rm -r dist
fi