Skip to content

Build and upload to PyPI #1

Build and upload to PyPI

Build and upload to PyPI #1

Workflow file for this run

name: Build and upload to PyPI
on:
release:
types: [published]
permissions: {}
jobs:
build:
name: Build packages
runs-on: ubuntu-latest
if: github.owner == 'xarray-contrib'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build
run: |
python -m build --outdir dist/ .
- name: Check the built archives
run: |
twine check dist/*
pip install dist/*.whl
minimum-versions --help
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: packages
path: dist/*
publish:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
environment:
name: pypi
url: https://pypi.org/p/xarray-minimum-dependency-policy
permissions:
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v7
with:
name: packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
verify_metadata: true
verbose: true