Skip to content

feat: update to v0.2 ACP spec (#41) #31

feat: update to v0.2 ACP spec (#41)

feat: update to v0.2 ACP spec (#41) #31

Workflow file for this run

name: Publish Python Package
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+.dev[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+.dev[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-acp
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%.dev*}" ]; 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
# Update version to match in case it is a dev version
if [ ! "${TAG%.dev*}" = "${TAG}" ]; then
sed "s/version = \"${TAG%.dev*}\"/version = \"${TAG}\"/" pyproject.toml >pyproject.toml.bak \
&& mv pyproject.toml.bak pyproject.toml
fi
echo "Building and publishing version: ${TAG}" >> $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