Skip to content

✏️ Edit URLs to shapefiles from UNOSAT (#138) #117

✏️ Edit URLs to shapefiles from UNOSAT (#138)

✏️ Edit URLs to shapefiles from UNOSAT (#138) #117

# Publish archives to PyPI and TestPyPI using GitHub Actions
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish to PyPI
# Only run for pushes to the main branch and releases.
on:
push:
branches:
- main
release:
types:
- published
# Runs for pull requests should be disabled other than for testing purposes
#pull_request:
# branches:
# - main
permissions:
contents: read
jobs:
publish-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-22.04
permissions:
# This permission is mandatory for OIDC publishing
id-token: write
if: github.repository == 'weiji14/zen3geo'
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# fetch all history so that poetry-dynamic-versioning works
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.11.8'
- name: Install Poetry and dynamic-versioning plugin
run: |
pip install poetry==1.6.1
poetry self add poetry-dynamic-versioning[plugin]
poetry show
- name: Fix up version string for TestPyPI and PyPI
run: |
# Change poetry-dynamic-versioning to use metadata=false so that the
# local part of the version isn't included, making the version string
# compatible with PyPI.
sed --in-place "s/metadata = true/metadata = false/g" pyproject.toml
- name: Build a binary wheel and a source tarball
run: |
poetry build -vvv
echo ""
echo "Generated files:"
ls -lh dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598 # v1.8.6
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598 # v1.8.6