-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (66 loc) · 1.88 KB
/
Copy pathpublish-pypi.yml
File metadata and controls
75 lines (66 loc) · 1.88 KB
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
---
# 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:
prepare-environment:
uses: ./.github/workflows/define-versions.yml
publish_to_pypi:
name: "Publish Infrahub SDK to PyPI"
runs-on: "ubuntu-22.04"
needs: prepare-environment
steps:
- name: "Set up Python"
uses: "actions/setup-python@v6"
with:
python-version: "3.12"
- name: Install UV
uses: astral-sh/setup-uv@v7
with:
version: ${{ needs.prepare-environment.outputs.UV_VERSION }}
- name: "Check out repository code"
uses: "actions/checkout@v7"
with:
submodules: true
- name: Cache UV dependencies
uses: "actions/cache@v5"
id: "cached-uv-dependencies"
with:
path: ".venv"
key: "venv-${{ runner.os }}-${{ hashFiles('uv.lock') }}"
- name: Install Dependencies
run: uv sync --all-groups --all-extras
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
- name: Build package
run: uv build
- name: Show output
run: ls -la dist/
- name: Publish to PyPI
if: ${{ inputs.publish }}
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish