Repository navigation
Expand file tree
/
Copy pathpython-agent-framework-release.yml
More file actions
121 lines (110 loc) · 3.62 KB
/
Copy pathpython-agent-framework-release.yml
File metadata and controls
121 lines (110 loc) · 3.62 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
name: Microsoft Agent Framework Integration Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
target:
description: "Publish target"
required: true
type: choice
default: "testpypi"
options:
- testpypi
- pypi
- both
permissions:
contents: read
jobs:
build-package:
name: Build openviking-ms-agent-framework
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'openviking-ms-agent-framework@')
runs-on: ubuntu-24.04
defaults:
run:
working-directory: integrations/frameworks/microsoft-agent-framework
outputs:
publish_target: ${{ steps.target.outputs.publish_target }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set publish target
id: target
env:
EVENT_NAME: ${{ github.event_name }}
TARGET: ${{ inputs.target }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
echo "publish_target=$TARGET" >> "$GITHUB_OUTPUT"
else
echo "publish_target=pypi" >> "$GITHUB_OUTPUT"
fi
- name: Validate release tag
if: github.event_name == 'release'
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
PACKAGE_VERSION=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
EXPECTED_TAG="openviking-ms-agent-framework@$PACKAGE_VERSION"
if [ "$RELEASE_TAG" != "$EXPECTED_TAG" ]; then
echo "Tag $RELEASE_TAG does not match expected tag $EXPECTED_TAG"
exit 1
fi
- name: Install package and release dependencies
run: python -m pip install '.[test,dev]'
- name: Check package and offline contracts
run: |
ruff check .
ruff format --check .
mypy src
pytest -q --confcutdir=tests tests
- name: Build and validate distributions
run: |
python -m build
python -m twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: agent-framework-distributions
path: integrations/frameworks/microsoft-agent-framework/dist/*
if-no-files-found: error
publish-testpypi:
name: Publish to TestPyPI
needs: [build-package]
if: needs.build-package.outputs.publish_target == 'testpypi' || needs.build-package.outputs.publish_target == 'both'
runs-on: ubuntu-24.04
environment:
name: testpypi
url: https://test.pypi.org/p/openviking-ms-agent-framework
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: agent-framework-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true
publish-pypi:
name: Publish to PyPI
needs: [build-package]
if: needs.build-package.outputs.publish_target == 'pypi' || needs.build-package.outputs.publish_target == 'both'
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/openviking-ms-agent-framework
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: agent-framework-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true