-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (66 loc) · 1.91 KB
/
publish-pypi.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
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
---
# yamllint disable rule:truthy
name: Publish Infrahub SDK Package
on:
workflow_dispatch:
inputs:
runs-on:
description: "The OS to run the job on"
required: false
default: "ubuntu-22.04"
type: string
publish:
type: boolean
description: Whether to publish the package to Pypi
required: false
default: false
workflow_call:
inputs:
runs-on:
description: "The OS to run the job on"
required: false
default: "ubuntu-22.04"
type: string
publish:
type: boolean
description: Whether to publish the package to Pypi
required: false
default: false
jobs:
publish_to_pypi:
name: "Publish Infrahub SDK to PyPI"
runs-on: "ubuntu-22.04"
steps:
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
- name: "Install Poetry"
uses: "snok/install-poetry@v1"
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
submodules: true
- name: "Cache poetry venv"
uses: "actions/cache@v4"
id: "cached-poetry-dependencies"
with:
path: "./python_sdk/.venv"
key: "venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}"
- name: "Install Dependencies"
run: "poetry install"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: "Add PyPI secret"
run: "poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}"
- name: "Poetry build"
run: "poetry build"
- name: "show output"
run: "ls -la dist/"
- name: "Poetry push PyPI"
if: ${{ inputs.publish }}
run: "poetry publish"