app/.github/workflows/pypi-publish.yml
2024-08-18 21:45:11 +08:00

36 lines
913 B
YAML

name: Publish
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
- name: Check version
run: |
current_version=$(pdm show --json | jq -r '.version')
echo "Current version: $current_version"
package_name=$(pdm show --json | jq -r '.name')
last_version=$(curl -s https://pypi.org/pypi/$package_name/json | jq -r '.info.version')
echo "Last version on PyPI: $last_version"
if [ "$current_version" == "$last_version" ]; then
echo "Version has not been updated."
exit 1
fi
- name: Publish package distributions to PyPI
run: pdm publish