Skip to content

Prepare v0.3.1 (#38) #32

Prepare v0.3.1 (#38)

Prepare v0.3.1 (#38) #32

Workflow file for this run

name: Publish Python 🐍 distributions 📦 to TestPyPI
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
jobs:
# Wheels no longer offered until library linking is clarified.
build:
name: Build Source distribution and Wheels
runs-on: ${{ matrix.os }}
strategy:
# fail-fast: false
matrix:
# os: ["ubuntu-latest", "macos-latest"]
# python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: ubuntu-latest
python-version: "3.x"
defaults:
run:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: true
- name: Set up Python3
id: pyinstalled
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
# - name: Set up Python${{ matrix.python-version }} with NetCDF4 (conda)
# if: ${{ matrix.os == 'windows-latest' }}
# uses: mamba-org/provision-with-micromamba@main
# with:
# cache-downloads: true
# micromamba-version: 'latest'
# extra-specs: |
# python=${{ matrix.python-version }}
# build
# virtualenv
# - name: Install NetCDF4 (Ubuntu/apt)
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: |
# sudo apt-get update
# sudo apt-get install libnetcdf-dev
# - name: Install NetCDF4 (macOS/homebrew)
# if: ${{ matrix.os == 'macos-latest' }}
# uses: tecolicom/actions-use-homebrew-tools@v1
# with:
# tools: netcdf
# cache: yes
- name: Install packaging libraries (Ubuntu/macOS)
if: ${{ matrix.os != 'windows-latest' }}
run: ${{ steps.pyinstalled.outputs.python-path }} -m pip install build virtualenv
# - name: Build a binary wheel (Windows)
# if: ${{ matrix.os == 'windows-latest' }}
# run: python -m build --wheel
# - name: Build a binary wheel (Ubuntu/macOS)
# if: ${{ matrix.os != 'windows-latest' }}
# run: ${{ steps.pyinstalled.outputs.python-path }} -m build --wheel
- name: Build a source tarball (Ubuntu)
if: |
(matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.x')
run: ${{ steps.pyinstalled.outputs.python-path }} -m build --sdist
- uses: actions/upload-artifact@v4
with:
path: |
dist/*.tar.gz
# dist/*.whl
if-no-files-found: error
publish-testpypi:
name: Publish Python 🐍 distributions 📦 to TestPyPI
needs: build
runs-on: ubuntu-latest
environment: staging
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
id: download
with:
name: artifact
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
print-hash: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true