-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (92 loc) · 3.25 KB
/
python-publish-release.yml
File metadata and controls
106 lines (92 loc) · 3.25 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
98
99
100
101
102
103
104
105
106
name: (PyRelease) Publish Python SDK Release
on: workflow_dispatch
# Creates a release in Github repo. Does not publish package to Pypi
jobs:
build_and_test_sdk:
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
uses: ./.github/workflows/python-build-and-test.yml
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
create_release:
needs: build_and_test_sdk
strategy:
matrix:
python-version: ['3.10']
os: [windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Create venv and build wheel
working-directory: ./python_sdk
run: |
python -m venv venv
./venv/Scripts/Activate.ps1
python -m pip install build
python -m build
shell: pwsh
- name: Find Wheel File
id: find_wheel
working-directory: ./python_sdk/dist
run: |
$wheel = Get-ChildItem -Filter "*.whl" | Select-Object -First 1
$wheel_abs_path = $wheel.FullName
Write-Output "Wheel found: $wheel_abs_path"
"wheel_abs_path=$wheel_abs_path" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Install documentation dependencies
working-directory: ./python_sdk
run: |
./venv/Scripts/Activate.ps1
python -m pip install ${{ steps.find_wheel.outputs.wheel_abs_path }}
python -m pip install .[dev]
shell: pwsh
- name: Build documentation
working-directory: ./python_sdk/docs
run: |
../venv/Scripts/Activate.ps1
& ./make.bat html
shell: pwsh
- name: Reformat doc
id: reformat_doc
working-directory: python_sdk/docs
run: |
New-Item -Path ".\User Guide\en" -ItemType Directory -Force
Copy-Item -Path .\_build\html -Destination ".\User Guide\en\html5" -Recurse
Compress-Archive -Path ".\User Guide" -DestinationPath .\Documentation.zip
$zip_abs_path = (Get-Item ".\Documentation.zip").FullName
Write-Host "Zip path : $zip_abs_path"
"doc_zip_path=$zip_abs_path" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Get version from pyproject
working-directory: python_sdk
id: extract_version
run: |
.\venv\Scripts\Activate.ps1
python -m pip install toml
$version = .\venv\Scripts\python -c "import toml; print(toml.load(open('pyproject.toml'))['project']['version'])"
Write-Host "Version : $version"
"version=$version" >> $env:GITHUB_OUTPUT
shell: pwsh
# TODO : add make_latest, body_path and generate_release_notes?
- name: Create Release
uses: softprops/action-gh-release@v2
id: create_release
with:
tag_name: ${{ steps.extract_version.outputs.version }}-py
name: "Python Version ${{ steps.extract_version.outputs.version }}"
draft: true
files: |
${{ steps.find_wheel.outputs.wheel_abs_path }}
${{ steps.reformat_doc.outputs.doc_zip_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}