Skip to content

v0.1.2

v0.1.2 #1

Workflow file for this run

# Publish to PyPI
#
# This workflow publishes nii2dcm on PyPI. The workflow triggers
# on release. The PyPI release is labelled according to the git tag
# specified in the GitHub Release user interface. For instance,
# if the TestPyPI release is v0.1.2.post16, then the GitHub Release
# tag should be entered as v0.1.3, which will propagate to PyPI.
# Subsequent developer commits will become v0.1.3.post1, v0.1.3.post2,
# and so on.
#
# This workflow will upload a Python Package using Twine when a release is created. For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
#
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish package to PyPI
on:
release:
types: [published]
permissions:
contents: read
actions: write
jobs:
testpypi-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nii2dcm
permissions:
contents: read
actions: write
id-token: write # IMPORTANT: this permission is mandatory for PyPI trusted publishing
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt
- name: Build package
run: pip install .
- name: Display version via dunamai
run: |
echo "version via dunamai:"
dunamai from any
- name: Display version via nii2dcm CLI
run: |
echo "version via nii2dcm CLI:"
nii2dcm -v
- name: Create dist/
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
- name: Wait to allow PyPI to update
uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '150' # seconds
- name: Install latest PyPI version in fresh venv
run: |
NII2DCM_VERSION=`echo "$(nii2dcm -v)"`
echo $NII2DCM_VERSION
python -m venv nii2dcm-temp
source nii2dcm-temp/bin/activate
pip install --upgrade pip
pip install setuptools wheel
pip install nii2dcm==$NII2DCM_VERSION
nii2dcm -h
echo "nii2dcm version:"
nii2dcm -v