Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0, v1.2.3
release:
types: [published]
workflow_dispatch: # Allow manual trigger
inputs:
version_type:
description: 'Version bump type'
required: true
type: choice
default: 'patch'
options:
- patch
- minor
- major

jobs:
publish-asgardeo:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.new_version }}
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Update version for manual trigger
id: version
if: github.event_name == 'workflow_dispatch'
working-directory: ./packages/asgardeo
run: |
echo "Bumping version: ${{ github.event.inputs.version_type }}"
poetry version ${{ github.event.inputs.version_type }}
NEW_VERSION=$(poetry version -s)
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "New asgardeo version: $NEW_VERSION"

- name: Build asgardeo package
working-directory: ./packages/asgardeo
run: |
poetry install
poetry build
echo "✅ asgardeo package built successfully"

- name: Publish asgardeo to PyPI
working-directory: ./packages/asgardeo
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
echo "🚀 Publishing asgardeo to PyPI..."
poetry publish
echo "✅ asgardeo published successfully"

publish-asgardeo-ai:
runs-on: ubuntu-latest
needs: publish-asgardeo # Wait for asgardeo to be published first
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Update asgardeo-ai version for manual trigger
if: github.event_name == 'workflow_dispatch'
working-directory: ./packages/asgardeo-ai
run: |
echo "Bumping version: ${{ github.event.inputs.version_type }}"
poetry version ${{ github.event.inputs.version_type }}
NEW_AI_VERSION=$(poetry version -s)
echo "New asgardeo-ai version: $NEW_AI_VERSION"

- name: Wait for asgardeo to be available on PyPI
run: |
echo "⏳ Waiting 2 minutes for asgardeo package to be available on PyPI..."
sleep 120
echo "✅ Wait complete, proceeding with asgardeo-ai"

- name: Update asgardeo dependency to use PyPI version
working-directory: ./packages/asgardeo-ai
run: |
if [ -n "${{ needs.publish-asgardeo.outputs.new_version }}" ]; then
ASGARDEO_VERSION="${{ needs.publish-asgardeo.outputs.new_version }}"
else
# For tag-based releases, extract version from tag
ASGARDEO_VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "🔄 Updating asgardeo dependency to version: $ASGARDEO_VERSION"

# Replace local path dependency with PyPI version
sed -i "s/asgardeo = { path = \"..\/asgardeo\", develop = true }/asgardeo = \"^$ASGARDEO_VERSION\"/" pyproject.toml

echo "✅ Updated dependency in pyproject.toml"
grep "asgardeo = " pyproject.toml

- name: Build asgardeo-ai package
working-directory: ./packages/asgardeo-ai
run: |
poetry install
poetry build
echo "✅ asgardeo-ai package built successfully"

- name: Publish asgardeo-ai to PyPI
working-directory: ./packages/asgardeo-ai
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
echo "🚀 Publishing asgardeo-ai to PyPI..."
poetry publish
echo "✅ asgardeo-ai published successfully"

summary:
runs-on: ubuntu-latest
needs: [publish-asgardeo, publish-asgardeo-ai]
if: always()
steps:
- name: Publication Summary
run: |
echo "📋 Publication Summary"
echo "===================="
echo "✅ asgardeo package published"
echo "✅ asgardeo-ai package published"

if [ -n "${{ needs.publish-asgardeo.outputs.new_version }}" ]; then
echo "🔖 Published version: ${{ needs.publish-asgardeo.outputs.new_version }}"
fi

echo ""
echo "🎉 Publication workflow completed!"
55 changes: 55 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test and Build

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Build asgardeo package
working-directory: ./packages/asgardeo
run: |
poetry install
poetry build
echo "asgardeo package built successfully"

- name: Build asgardeo-ai package
working-directory: ./packages/asgardeo-ai
run: |
poetry install
poetry build
echo "asgardeo-ai package built successfully"

- name: Upload asgardeo build artifacts
uses: actions/upload-artifact@v3
with:
name: asgardeo-dist-${{ matrix.python-version }}
path: packages/asgardeo/dist/

- name: Upload asgardeo-ai build artifacts
uses: actions/upload-artifact@v3
with:
name: asgardeo-ai-dist-${{ matrix.python-version }}
path: packages/asgardeo-ai/dist/
100 changes: 90 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,104 @@
# Compiled class file
*.class
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Virtual environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Poetry
poetry.lock
.poetry/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Log file
# Logs
*.log

# BlueJ files
*.ctxt
# MyPy
.mypy_cache/
.dmypy.json
dmypy.json

# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Environments
.env.local
.env.*.local

# Package Files #
# Compiled files
*.class
*.ctxt
.mtj.tmp/
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
Loading