-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (123 loc) · 4.02 KB
/
Copy pathpublish-python.yml
File metadata and controls
148 lines (123 loc) · 4.02 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Generated by scitrera-repo-tools `generate-ci-gha`. Do not edit by hand;
# re-run the generator after editing versions.yaml. Run
# `generate-ci-gha` (no flags) to check for drift, `generate-ci-gha --force` to apply.
name: Publish (Python)
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
concurrency:
group: publish-python
cancel-in-progress: false
permissions:
contents: read
id-token: write
jobs:
tests:
uses: ./.github/workflows/test-python.yml
verify-tag:
name: Verify tag matches aether-sdk-python version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
- name: Verify versions are in sync
run: uvx --from 'scitrera-repo-tools==0.1.19' sync-versions --check --verbose
- name: Compare tag against versions.yaml
if: github.ref_type == 'tag'
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME#v}"
declared="$(uvx --from 'scitrera-repo-tools==0.1.19' sync-versions --print-version aether-sdk-python)"
if [ "$tag" != "$declared" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match the aether-sdk-python version declared in versions.yaml ($declared)"
exit 1
fi
echo "Tag ${GITHUB_REF_NAME} matches versions.yaml ($declared)."
publish-aether-sdk-python:
name: Publish aether-sdk-python to PyPI
runs-on: ubuntu-latest
needs: [ tests, verify-tag ]
environment:
name: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Rewrite local refs to version pins
run: uvx --from 'scitrera-repo-tools==0.1.19' sync-versions --release
- name: Build sdist + wheel
run: |
pip install build
python -m build
working-directory: sdk/python-client
- name: Publish to PyPI (trusted publisher)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: sdk/python-client/dist/
- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: dist-aether-sdk-python
path: sdk/python-client/dist/
if-no-files-found: error
publish-aether-sdk-python-ag2:
name: Publish aether-sdk-python-ag2 to PyPI
runs-on: ubuntu-latest
needs: [ tests, verify-tag ]
environment:
name: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Rewrite local refs to version pins
run: uvx --from 'scitrera-repo-tools==0.1.19' sync-versions --release
- name: Build sdist + wheel
run: |
pip install build
python -m build
working-directory: sdk/python-ag2
- name: Publish to PyPI (trusted publisher)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: sdk/python-ag2/dist/
- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: dist-aether-sdk-python-ag2
path: sdk/python-ag2/dist/
if-no-files-found: error
github-release:
name: Attach distributions to GitHub release
runs-on: ubuntu-latest
needs: [ publish-aether-sdk-python, publish-aether-sdk-python-ag2 ]
if: github.ref_type == 'tag'
permissions:
contents: write
steps:
- name: Download built distributions
uses: actions/download-artifact@v8
with:
pattern: dist-*
merge-multiple: true
path: dist/
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
files: dist/*
generate_release_notes: true