Files
omnara-agent-monitor/.github/workflows/release.yml
Kartik Sarangmath d12fe4a101 Initial commit
2025-07-08 19:17:44 -07:00

75 lines
2.1 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Extract version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
echo "# Changelog" > changelog.md
echo "" >> changelog.md
# Get commits since last tag
if git describe --tags --abbrev=0 HEAD^ 2>/dev/null; then
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^)
echo "## Changes since $LAST_TAG" >> changelog.md
git log $LAST_TAG..HEAD --pretty=format:"- %s" >> changelog.md
else
echo "## Initial Release" >> changelog.md
echo "First release of Omnara!" >> changelog.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: changelog.md
files: dist/*
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Publish to Test PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
twine upload --repository testpypi dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
if: ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}