Skip to content

Commit ba91c1c

Browse files
authored
Merge pull request #5 from shashimalcse/python-0004
Fix asgardeo-ai build and add seperate workflows
2 parents b989c85 + a3a5a2b commit ba91c1c

File tree

4 files changed

+176
-153
lines changed

4 files changed

+176
-153
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish asgardeo-ai to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'asgardeo-ai-v*' # e.g. asgardeo-ai-v1.2.3
7+
workflow_dispatch:
8+
inputs:
9+
version_type:
10+
description: 'Version bump type (only used for manual dispatch)'
11+
required: true
12+
type: choice
13+
default: patch
14+
options: [patch, minor, major]
15+
asgardeo_version:
16+
description: 'Optional: set asgardeo version (e.g. ^1.2.3) if converting from path dep'
17+
required: false
18+
type: string
19+
20+
jobs:
21+
publish-asgardeo-ai:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.10'
30+
31+
- name: Install Poetry
32+
uses: snok/install-poetry@v1
33+
with:
34+
version: latest
35+
virtualenvs-create: true
36+
virtualenvs-in-project: true
37+
38+
- name: Bump version (manual dispatch only)
39+
if: github.event_name == 'workflow_dispatch'
40+
working-directory: ./packages/asgardeo-ai
41+
id: bump
42+
run: |
43+
echo "Bumping version: ${{ github.event.inputs.version_type }}"
44+
poetry version ${{ github.event.inputs.version_type }}
45+
NEW_VERSION=$(poetry version -s)
46+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
47+
echo "New asgardeo-ai version: $NEW_VERSION"
48+
49+
- name: Ensure asgardeo dependency uses PyPI, not path
50+
working-directory: ./packages/asgardeo-ai
51+
run: |
52+
if grep -q 'asgardeo = { path' pyproject.toml; then
53+
echo 'Path dependency detected.'
54+
if [ -n "${{ github.event.inputs.asgardeo_version }}" ]; then
55+
TARGET="${{ github.event.inputs.asgardeo_version }}"
56+
echo "Converting to version spec: $TARGET"
57+
sed -i "s|asgardeo = { path = \"..\/asgardeo\", develop = true }|asgardeo = \"$TARGET\"|" pyproject.toml
58+
else
59+
echo 'ERROR: Provide asgardeo_version input to replace path dependency.' >&2
60+
exit 1
61+
fi
62+
else
63+
echo 'asgardeo already uses a version spec.'
64+
fi
65+
echo 'Current asgardeo dependency line:'
66+
grep '^asgardeo\s*=' pyproject.toml || true
67+
68+
- name: Validate tag vs pyproject version (tag builds)
69+
if: startsWith(github.ref, 'refs/tags/asgardeo-ai-v')
70+
working-directory: ./packages/asgardeo-ai
71+
run: |
72+
TAG_VERSION="${GITHUB_REF_NAME#asgardeo-ai-v}"
73+
FILE_VERSION=$(poetry version -s)
74+
if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then
75+
echo "Tag version ($TAG_VERSION) does not match pyproject.toml version ($FILE_VERSION)." >&2
76+
exit 1
77+
fi
78+
echo "Tag and pyproject versions match: $TAG_VERSION"
79+
80+
- name: Install dependencies & build wheel
81+
working-directory: ./packages/asgardeo-ai
82+
run: |
83+
poetry install
84+
poetry build
85+
86+
- name: Publish to PyPI
87+
working-directory: ./packages/asgardeo-ai
88+
env:
89+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
90+
run: |
91+
echo "Publishing asgardeo-ai to PyPI"
92+
poetry publish
93+
echo "Published asgardeo-ai"
94+
95+
- name: Summary
96+
working-directory: ./packages/asgardeo-ai
97+
run: |
98+
VERSION=$(poetry version -s)
99+
echo "asgardeo-ai version published: $VERSION"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish asgardeo to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'asgardeo-v*' # e.g. asgardeo-v1.2.3
7+
workflow_dispatch:
8+
inputs:
9+
version_type:
10+
description: 'Version bump type (only used for manual dispatch)'
11+
required: true
12+
type: choice
13+
default: patch
14+
options: [patch, minor, major]
15+
16+
jobs:
17+
publish-asgardeo:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.10'
26+
27+
- name: Install Poetry
28+
uses: snok/install-poetry@v1
29+
with:
30+
version: latest
31+
virtualenvs-create: true
32+
virtualenvs-in-project: true
33+
34+
- name: Bump version (manual dispatch only)
35+
if: github.event_name == 'workflow_dispatch'
36+
working-directory: ./packages/asgardeo
37+
id: bump
38+
run: |
39+
echo "Bumping version: ${{ github.event.inputs.version_type }}"
40+
poetry version ${{ github.event.inputs.version_type }}
41+
NEW_VERSION=$(poetry version -s)
42+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
43+
echo "New version: $NEW_VERSION"
44+
45+
- name: Validate tag vs pyproject version (tag builds)
46+
if: startsWith(github.ref, 'refs/tags/asgardeo-v')
47+
working-directory: ./packages/asgardeo
48+
run: |
49+
TAG_VERSION="${GITHUB_REF_NAME#asgardeo-v}"
50+
FILE_VERSION=$(poetry version -s)
51+
if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then
52+
echo "Tag version ($TAG_VERSION) does not match pyproject.toml version ($FILE_VERSION)." >&2
53+
exit 1
54+
fi
55+
echo "Tag and pyproject versions match: $TAG_VERSION"
56+
57+
- name: Install dependencies & build wheel
58+
working-directory: ./packages/asgardeo
59+
run: |
60+
poetry install
61+
poetry build
62+
63+
- name: Publish to PyPI
64+
working-directory: ./packages/asgardeo
65+
env:
66+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
67+
run: |
68+
echo "Publishing asgardeo to PyPI"
69+
poetry publish
70+
echo "Published asgardeo"
71+
72+
- name: Summary
73+
working-directory: ./packages/asgardeo
74+
run: |
75+
VERSION=$(poetry version -s)
76+
echo "asgardeo version published: $VERSION"

.github/workflows/publish.yml

Lines changed: 0 additions & 151 deletions
This file was deleted.

packages/asgardeo-ai/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ packages = [{ include = "asgardeo_ai", from = "src" }]
1010
[tool.poetry.dependencies]
1111
python = ">=3.10,<4.0"
1212
httpx = "^0.28.0"
13-
asgardeo = { path = "../asgardeo", develop = true }
14-
13+
asgardeo = "^0.2.1"
1514

1615
[build-system]
1716
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)