Skip to content

[pre-commit.ci] pre-commit autoupdate #23

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #23

Workflow file for this run

name: Upload Package to PyPI
on:
release:
types:
- published
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build-artifacts:
name: Build packages
runs-on: ubuntu-latest
if: |
github.repository == 'xarray-contrib/pint-xarray'
&& (
github.event_name == 'release'
|| contains(github.event.pull_request.labels.*.name, 'release')
)
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
name: Install Python
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build tarball and wheels
run: |
git clean -xdf
git restore -SW .
python -m build --outdir dist/ .
- name: Check built artifacts
run: |
python -m twine check --strict dist/*
pwd
if [ -f dist/pint-xarray-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: releases
path: dist
upload-to-pypi:
name: Upload to PyPI
needs: build-artifacts
if: github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pint-xarray
permissions:
id-token: write # upload packages to pypi
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
verbose: true