Document the support policy for optional packages (#3616) #1854
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publish archives to PyPI and TestPyPI using GitHub Actions | |
# | |
# This workflow is ran to publish PyGMT archives (source and binary distributions) | |
# to TestPyPI (for testing only) and PyPI. | |
# | |
# Archives will be pushed to TestPyPI for every commit to the main branch and | |
# tagged releases, and to PyPI for tagged releases only. | |
# | |
# Note that authentication to TestPyPI/PyPI is done via OpenID Connect, see also | |
# https://github.com/pypa/gh-action-pypi-publish/tree/release/v1#publishing-with-openid-connect | |
# | |
# Important: this workflow filename must be publish-to-pypi.yml to match the | |
# settings in PyPI and TestPyPI so that OIDC publishing works. | |
# | |
name: Publish to PyPI | |
# Only run for pushes to the main branch and releases. | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'pygmt/**' | |
- '!pygmt/tests/**' | |
- 'Makefile' | |
- 'MANIFEST.in' | |
- 'pyproject.toml' | |
- 'README.md' | |
- '.github/workflows/publish-to-pypi.yml' | |
release: | |
types: | |
- published | |
# Runs for pull requests should be disabled other than for testing purposes | |
#pull_request: | |
# branches: | |
# - main | |
jobs: | |
publish-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
permissions: | |
# This permission is mandatory for OIDC publishing | |
id-token: write | |
if: github.repository == 'GenericMappingTools/pygmt' | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
# fetch all history so that setuptools-scm works | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: python -m pip install build | |
# This step is only necessary for testing purposes and for TestPyPI | |
- name: Fix up version string for TestPyPI | |
if: ${{ !startsWith(github.ref, 'refs/tags') }} | |
run: | | |
# Change setuptools-scm local_scheme to "no-local-version" so the | |
# local part of the version isn't included, making the version string | |
# compatible with PyPI. | |
sed --in-place "s/node-and-date/no-local-version/g" pyproject.toml | |
- name: Build source and wheel distributions | |
run: | | |
make package | |
echo "" | |
echo "Generated files:" | |
ls -lh dist/ | |
- name: Publish to Test PyPI | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/[email protected] |