Skip to content

0.3.0.4

0.3.0.4 #8

Workflow file for this run

name: Build and upload to PyPI
on:
workflow_dispatch: # run on request (no need for PR)
release:
types: [published]
permissions: {} # No permissions by default on workflow level
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python 3.10
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
- name: Install pypa/build
run: |
python -m pip install --upgrade build
- name: Build sdist
run: |
python -m build --sdist src/python/
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-sdist
path: src/python/dist/*.tar.gz
- name: Build wheel
run: |
python -m build --wheel src/python/
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-wheel
path: src/python/dist/*.whl
publish_package:
name: Publish package
needs: [build]
environment: pypi
runs-on: ubuntu-latest
permissions:
contents: write # required by svenstaro/upload-release-action
id-token: write # required by trusted publisher
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: artifact-*
merge-multiple: true
# to determine where to publish the package distribution to PyPI or TestPyPI
- name: Check tag
id: check-tag
uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2
with:
text: ${{ github.ref }}
regex: '^refs/tags/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)+(\.[0-9]+rc[0-9]+|rc[0-9]+)?$'
- name: Upload package distributions to github
if: ${{ steps.check-tag.outputs.match != '' }}
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # v2.11.2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Publish package distributions to PyPI
if: ${{ steps.check-tag.outputs.match != '' }}
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
- name: Publish package distributions to TestPyPI
if: ${{ steps.check-tag.outputs.match == '' }}
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://test.pypi.org/legacy/
verbose: true