Skip to content

Commit 72d2eb0

Browse files
authored
Merge pull request #2 from shashimalcse/sdk2
Init Basic SDK
2 parents 942bf69 + 63041bd commit 72d2eb0

File tree

18 files changed

+1814
-12
lines changed

18 files changed

+1814
-12
lines changed

.github/workflows/publish.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on version tags like v1.0.0, v1.2.3
7+
release:
8+
types: [published]
9+
workflow_dispatch: # Allow manual trigger
10+
inputs:
11+
version_type:
12+
description: 'Version bump type'
13+
required: true
14+
type: choice
15+
default: 'patch'
16+
options:
17+
- patch
18+
- minor
19+
- major
20+
21+
jobs:
22+
publish-asgardeo:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
new_version: ${{ steps.version.outputs.new_version }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.10'
33+
34+
- name: Install Poetry
35+
uses: snok/install-poetry@v1
36+
with:
37+
version: latest
38+
virtualenvs-create: true
39+
virtualenvs-in-project: true
40+
41+
- name: Update version for manual trigger
42+
id: version
43+
if: github.event_name == 'workflow_dispatch'
44+
working-directory: ./packages/asgardeo
45+
run: |
46+
echo "Bumping version: ${{ github.event.inputs.version_type }}"
47+
poetry version ${{ github.event.inputs.version_type }}
48+
NEW_VERSION=$(poetry version -s)
49+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
50+
echo "New asgardeo version: $NEW_VERSION"
51+
52+
- name: Build asgardeo package
53+
working-directory: ./packages/asgardeo
54+
run: |
55+
poetry install
56+
poetry build
57+
echo "✅ asgardeo package built successfully"
58+
59+
- name: Publish asgardeo to PyPI
60+
working-directory: ./packages/asgardeo
61+
env:
62+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
63+
run: |
64+
echo "🚀 Publishing asgardeo to PyPI..."
65+
poetry publish
66+
echo "✅ asgardeo published successfully"
67+
68+
publish-asgardeo-ai:
69+
runs-on: ubuntu-latest
70+
needs: publish-asgardeo # Wait for asgardeo to be published first
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Set up Python
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: '3.10'
78+
79+
- name: Install Poetry
80+
uses: snok/install-poetry@v1
81+
with:
82+
version: latest
83+
virtualenvs-create: true
84+
virtualenvs-in-project: true
85+
86+
- name: Update asgardeo-ai version for manual trigger
87+
if: github.event_name == 'workflow_dispatch'
88+
working-directory: ./packages/asgardeo-ai
89+
run: |
90+
echo "Bumping version: ${{ github.event.inputs.version_type }}"
91+
poetry version ${{ github.event.inputs.version_type }}
92+
NEW_AI_VERSION=$(poetry version -s)
93+
echo "New asgardeo-ai version: $NEW_AI_VERSION"
94+
95+
- name: Wait for asgardeo to be available on PyPI
96+
run: |
97+
echo "⏳ Waiting 2 minutes for asgardeo package to be available on PyPI..."
98+
sleep 120
99+
echo "✅ Wait complete, proceeding with asgardeo-ai"
100+
101+
- name: Update asgardeo dependency to use PyPI version
102+
working-directory: ./packages/asgardeo-ai
103+
run: |
104+
if [ -n "${{ needs.publish-asgardeo.outputs.new_version }}" ]; then
105+
ASGARDEO_VERSION="${{ needs.publish-asgardeo.outputs.new_version }}"
106+
else
107+
# For tag-based releases, extract version from tag
108+
ASGARDEO_VERSION="${GITHUB_REF#refs/tags/v}"
109+
fi
110+
echo "🔄 Updating asgardeo dependency to version: $ASGARDEO_VERSION"
111+
112+
# Replace local path dependency with PyPI version
113+
sed -i "s/asgardeo = { path = \"..\/asgardeo\", develop = true }/asgardeo = \"^$ASGARDEO_VERSION\"/" pyproject.toml
114+
115+
echo "✅ Updated dependency in pyproject.toml"
116+
grep "asgardeo = " pyproject.toml
117+
118+
- name: Build asgardeo-ai package
119+
working-directory: ./packages/asgardeo-ai
120+
run: |
121+
poetry install
122+
poetry build
123+
echo "✅ asgardeo-ai package built successfully"
124+
125+
- name: Publish asgardeo-ai to PyPI
126+
working-directory: ./packages/asgardeo-ai
127+
env:
128+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
129+
run: |
130+
echo "🚀 Publishing asgardeo-ai to PyPI..."
131+
poetry publish
132+
echo "✅ asgardeo-ai published successfully"
133+
134+
summary:
135+
runs-on: ubuntu-latest
136+
needs: [publish-asgardeo, publish-asgardeo-ai]
137+
if: always()
138+
steps:
139+
- name: Publication Summary
140+
run: |
141+
echo "📋 Publication Summary"
142+
echo "===================="
143+
echo "✅ asgardeo package published"
144+
echo "✅ asgardeo-ai package published"
145+
146+
if [ -n "${{ needs.publish-asgardeo.outputs.new_version }}" ]; then
147+
echo "🔖 Published version: ${{ needs.publish-asgardeo.outputs.new_version }}"
148+
fi
149+
150+
echo ""
151+
echo "🎉 Publication workflow completed!"

.github/workflows/test-build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test and Build
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test-build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.10']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
26+
with:
27+
version: latest
28+
virtualenvs-create: true
29+
virtualenvs-in-project: true
30+
31+
- name: Build asgardeo package
32+
working-directory: ./packages/asgardeo
33+
run: |
34+
poetry install
35+
poetry build
36+
echo "asgardeo package built successfully"
37+
38+
- name: Build asgardeo-ai package
39+
working-directory: ./packages/asgardeo-ai
40+
run: |
41+
poetry install
42+
poetry build
43+
echo "asgardeo-ai package built successfully"
44+
45+
- name: Upload asgardeo build artifacts
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: asgardeo-dist-${{ matrix.python-version }}
49+
path: packages/asgardeo/dist/
50+
51+
- name: Upload asgardeo-ai build artifacts
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: asgardeo-ai-dist-${{ matrix.python-version }}
55+
path: packages/asgardeo-ai/dist/

.gitignore

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,104 @@
1-
# Compiled class file
2-
*.class
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
24+
# PyInstaller
25+
*.manifest
26+
*.spec
27+
28+
# Installer logs
29+
pip-log.txt
30+
pip-delete-this-directory.txt
31+
32+
# Unit test / coverage reports
33+
htmlcov/
34+
.tox/
35+
.nox/
36+
.coverage
37+
.coverage.*
38+
.cache
39+
nosetests.xml
40+
coverage.xml
41+
*.cover
42+
.hypothesis/
43+
.pytest_cache/
44+
45+
# Virtual environments
46+
.env
47+
.venv
48+
env/
49+
venv/
50+
ENV/
51+
env.bak/
52+
venv.bak/
53+
54+
# Poetry
55+
poetry.lock
56+
.poetry/
57+
58+
# IDEs
59+
.vscode/
60+
.idea/
61+
*.swp
62+
*.swo
63+
*~
64+
65+
# OS
66+
.DS_Store
67+
.DS_Store?
68+
._*
69+
.Spotlight-V100
70+
.Trashes
71+
ehthumbs.db
72+
Thumbs.db
373

4-
# Log file
74+
# Logs
575
*.log
676

7-
# BlueJ files
8-
*.ctxt
77+
# MyPy
78+
.mypy_cache/
79+
.dmypy.json
80+
dmypy.json
981

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# pyenv
86+
.python-version
87+
88+
# Environments
89+
.env.local
90+
.env.*.local
1291

13-
# Package Files #
92+
# Compiled files
93+
*.class
94+
*.ctxt
95+
.mtj.tmp/
1496
*.jar
1597
*.war
1698
*.nar
1799
*.ear
18100
*.zip
19101
*.tar.gz
20102
*.rar
21-
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23103
hs_err_pid*
24104
replay_pid*

0 commit comments

Comments
 (0)