-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (79 loc) · 2.95 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (79 loc) · 2.95 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: PyPI release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
env:
DEFAULT_PYTHON: '3.14'
jobs:
release:
name: Release package
runs-on: ubuntu-latest
if: github.repository == 'MTSWebServices/data-rentgen' # prevent running on forks
environment:
name: pypi
url: https://pypi.org/p/data-rentgen
permissions:
id-token: write # to auth in PyPI
contents: write # to create Github release
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v7
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install system dependencies
# this step is needed for successful installation of "bonsai" library in python dependencies
run: sudo apt-get update && sudo apt-get install -y libldap2-dev libsasl2-dev
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
export UV=$(which uv)
make venv-install
- name: Generate OpenAPI Schema
run: |
make docs-openapi
- name: Fix logo in Readme
run: |
sed -i "s#image:: mddocs/docs/#image:: https://raw.githubusercontent.com/MTSWebServices/data-rentgen/$GITHUB_SHA/mddocs/docs/#g" README.rst
sed -i "s#logo_wide_white_text.svg#logo_wide.svg#g" README.rst
- name: Patch version template
# Due to change above, git stage area is dirty, so we need to patch the template
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}"#' pyproject.toml
- name: Build package
run: uv build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Generate SBOM
run: |
uv pip install cyclonedx-bom
uv export --all-extras --format requirements.txt | uv run cyclonedx-py requirements - > sbom.cyclonedx.json
- name: Prepare changelog
id: release-name
run: |
cat mddocs/docs/changelog/${GITHUB_REF_NAME}.md > changelog.md
# Remove anchors like "{ #0.5.1 }"
sed -i -E 's/\{.*\}//g' changelog.md
# Release name looks like: 0.7.0 (2023-05-15)
echo -n name= > "$GITHUB_OUTPUT"
cat changelog.md | head -1 | sed -E "s/#+\s*//g" >> "$GITHUB_OUTPUT"
# Remove header with release name
sed -i -e '1,2d' changelog.md
- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
name: ${{ steps.release-name.outputs.name }}
body_path: changelog.md
files: |-
dist/*.tar.gz
dist/*.whl
mddocs/docs/_static/openapi_server.json
mddocs/docs/_static/openapi_http2kafka.json
sbom.cyclonedx.json