Skip to content

update custom return dumper #37

update custom return dumper

update custom return dumper #37

name: Publish to PyPI
on:
push:
branches:
- main # 或你用来发布的分支
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.10.14
- name: Install poetry
run: |
pip install poetry
- name: Configure poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
- name: Parse version
id: parse_version
run: |
VERSION=$(poetry version -s)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if version exists on PyPI
id: check_version
run: |
response=$(curl -s https://pypi.org/pypi/codelinker/$VERSION/json)
if echo "$response" | grep -q 'Not Found'; then
echo "Version $VERSION does not exist on PyPI. Proceeding with publish."
echo "exists=false" >> $GITHUB_ENV
else
echo "Version $VERSION already exists on PyPI. Skipping publish."
echo "exists=true" >> $GITHUB_ENV
fi
- name: Build and publish
if: env.exists == 'false'
run: |
poetry build
poetry publish