Skip to content

feat: Add GHA to publish to PyPi. #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
61 changes: 61 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish Python Package

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'
workflow_dispatch:

env:
POETRY_VERSION: "2.1.1"

jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/agntcy-iomapper
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '>=3.9'
update-environment: true

- name: Install Poetry
run: |
pipx install poetry==${{ env.POETRY_VERSION }}

- name: Validate version if tag
if: github.event_name == 'push' && github.ref_type == 'tag'
env:
TAG_NAME: ${{ github.ref_name }}
run: |
TAG="${TAG_NAME##v}"
PYPROJECT_VERSION=$(awk '/version/ { gsub("\"", ""); print $3; exit; }' pyproject.toml)

if [ ! "${PYPROJECT_VERSION}" = "${TAG}" ]; then
echo "You created the \"${{ github.ref_name }}\"" git tag; it is fine, BUT it does not match the pyproject.toml file"
exit 1
fi

echo "Building and publishing version: ${PYPROJECT_VERSION}" >> $GITHUB_STEP_SUMMARY

- name: Build package
env:
POETRY_VIRTUALENVS_IN_PROJECT: "true"
run: |
poetry build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# IO-Mapper Agent

[![Release](https://img.shields.io/github/v/release/agntcy/iomapper-agnt?display_name=tag)](CHANGELOG.md)
[![Contributor-Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-fbab2c.svg)](CODE_OF_CONDUCT.md)
[![Contributor-Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-fbab2c.svg)](https://github.com/agntcy/acp-sdk/blob/main/CODE_OF_CONDUCT.md)

## About The Project

Expand Down Expand Up @@ -44,18 +43,18 @@ To get a local copy up and running follow these simple steps.
## Usage

Learn how to use our different Mappers
[USAGE.md](_usage.md)
[USAGE.md](https://agntcy.github.io/iomapper-agnt/#_usage.md)

## Contributing

Contributions are what make the open source community such an amazing place to
learn, inspire, and create. Any contributions you make are **greatly
appreciated**. For detailed contributing guidelines, please see
[CONTRIBUTING.md](CONTRIBUTING.md)
[CONTRIBUTING.md](https://github.com/agntcy/acp-sdk/blob/main/docs/CONTRIBUTING.md)

## Copyright Notice and License

[Copyright Notice and License](./LICENSE)
[Copyright Notice and License](https://github.com/agntcy/acp-sdk/blob/main/LICENSE)

Copyright (c) 2025 Cisco and/or its affiliates.

Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[project]
name = "agntcy-iomapper"
version = "0.2.0"
version = "0.2.0a0"
license = "Apache-2.0"
description = "A tool to transform output from one agent to the input of another."
readme = "README.md"
authors = [
{ name = "Jeff Napper", email = "[email protected]" },
{ name = "Reginaldo Costa", email = "[email protected]" },
{ name = "AGNTCY Internet of Agents Collective", email = "[email protected]" },
]
maintainers = [
{ name = "Jeff Napper", email = "[email protected]" },
{ name = "Reginaldo Costa", email = "[email protected]" },
{ name = "AGNTCY Internet of Agents Collective", email = "[email protected]" },
]

[tool.poetry.dependencies]
Expand Down
Loading