Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.
name: Upload paddle-billing-python-sdk Package to PyPi
on:
# release:
# types: [created]
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install build
- name: Build
run: |
python -m build
- name: Check if version has changed
id: check_version
run: |
LOCAL_VERSION=$(python setup.py --version)
PYPI_VERSION = requests.get('https://pypi.org/pypi/paddle-billing-python-sdk/json').json()['info']['version']
if [ "$LOCAL_VERSION" != "$PYPI_VERSION" ]; then
echo "Version has changed. Current version: $LOCAL_VERSION"
echo "##[set-output name=should_publish;]true"
else
echo "Version has not changed. Skipping publish."
echo "##[set-output name=should_publish;]false"
fi
- name: Publish to PyPi
if: steps.check_version.outputs.should_publish == 'true'
uses: pypa/gh-action-pypi-publish@release/v1