Skip to content

ci: fetch the dataset in smoke tests (no data is bundled) #5

ci: fetch the dataset in smoke tests (no data is bundled)

ci: fetch the dataset in smoke tests (no data is bundled) #5

Workflow file for this run

name: Release
# Triggered by a version tag (vX.Y.Z). It always builds the distributions, cuts a
# GitHub Release with the wheel + sdist attached, and publishes to PyPI using the
# PYPI_API_TOKEN repository secret.
#
# PyPI auth: the `PYPI_API_TOKEN` secret (set with `gh secret set PYPI_API_TOKEN`,
# value never in source). The publish job runs only on this repository, so forks
# never attempt to publish. To publish an already-tagged version (e.g. after adding
# the token later), use: Actions > Release > Run workflow > enter the tag.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Existing tag to build and publish (e.g. v0.1.0)"
required: true
permissions:
contents: read
jobs:
build:
name: build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build and check
run: |
python -m pip install --upgrade pip build twine
python -m build
twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*
github-release:
name: github release
needs: build
# Only when an actual tag is pushed (not on manual re-publish of an existing tag).
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
files: dist/*
fail_on_unmatched_files: true
publish-pypi:
name: publish to PyPI
needs: build
# Never publish from forks.
if: ${{ github.repository == 'NullRabbitLabs/nrdax-python' }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}