forked from ishanjainn/grafana-openai-monitoring
-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (60 loc) · 1.91 KB
/
pypi-release.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
name: PYPI Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version number to release'
required: true
permissions:
contents: write
defaults:
run:
working-directory: ./python
jobs:
publish:
name: Publish Package to PYPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
pip install build
- name: Create a new pyproject.toml
run: |
cat <<EOF > pyproject.toml
[tool.poetry]
name = "grafana-openai-monitoring"
version = "${{ github.event.inputs.version }}"
description = "Library to monitor your OpenAI usage and send metrics and logs to Grafana Cloud"
authors = ["Ishan Jain <[email protected]>"]
repository = "https://github.com/grafana/grafana-openai-monitoring"
readme = "README.md"
homepage = "https://github.com/grafana/grafana-openai-monitoring"
keywords = ["observability", "monitoring", "openai", "grafana", "gpt"]
[tool.poetry.dependencies]
python = "^3.7.1"
requests = "^2.26.0"
[build-system]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"
EOF
- name: Build package
run: python -m build
- name: Publish Package
run: python -m twine upload --repository pypi dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: "python-${{ github.event.inputs.version }}"