Skip to content

Doug/make params url safe (#28) #13

Doug/make params url safe (#28)

Doug/make params url safe (#28) #13

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# Install all dependencies from pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Get Version
id: version
run: |
RAW_VERSION=$(python -c "from socketdev.version import __version__; print(__version__)")
echo "VERSION=$RAW_VERSION" >> $GITHUB_ENV
if [ "v$RAW_VERSION" != "${{ github.ref_name }}" ]; then
echo "Error: Git tag (${{ github.ref_name }}) does not match package version (v$RAW_VERSION)"
exit 1
fi
- name: Check if version exists on PyPI
id: version_check
env:
VERSION: ${{ env.VERSION }}
run: |
if curl -s -f https://pypi.org/pypi/socket-sdk-python/$VERSION/json > /dev/null; then
echo "Version ${VERSION} already exists on PyPI"
echo "pypi_exists=true" >> $GITHUB_OUTPUT
else
echo "Version ${VERSION} not found on PyPI - proceeding with PyPI deployment"
echo "pypi_exists=false" >> $GITHUB_OUTPUT
fi
- name: Build package
if: steps.version_check.outputs.pypi_exists != 'true'
run: |
pip install build
python -m build
- name: Publish to PyPI
if: steps.version_check.outputs.pypi_exists != 'true'
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_TOKEN }}