Skip to content

Commit

Permalink
Refactors TestPyPI GHA to use dunamai
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaroberts committed Aug 31, 2023
1 parent 10ec043 commit 9c993b8
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions .github/workflows/publish_testpypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Publish to TestPyPI
#
# This workflow publishes nii2dcm on TestPyPI prior to production release onto PyPI. The workflow is intended to catch
# any issues arising during the release procedure to prevent unnecessary versioning issues on PyPI
# This workflow publishes nii2dcm on TestPyPI prior to
# production release onto PyPI. The workflow is intended to
# catch any issues arising during the release procedure to
# prevent unnecessary versioning issues on PyPI.
#
# 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
Expand All @@ -14,20 +16,25 @@
name: Publish package to TestPyPI

on:
pull_request
push:
branches:
- main
- 24-gha-pypi

permissions:
contents: read
actions: write

jobs:
testpypi-publish:

name: Publish release to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/nii2dcm
permissions:
contents: read
actions: write
id-token: write # IMPORTANT: this permission is mandatory for PyPI trusted publishing

steps:
Expand All @@ -43,18 +50,37 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install setuptools wheel
pip install -r requirements.txt
- name: Build package
run: python -m build --sdist --wheel --outdir dist/
run: python setup.py install

- name: Display version via dunamai
run: |
echo "dunamai version:"
dunamai from any
- name: Display nii2dcm version
- name: Display version via nii2dcm CLI
id: nii2dcm-version
run: |
pip install -e .
# pip install -e .
echo "nii2dcm version:"
nii2dcm -v

- name: Create dist/
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Remove .egg
run: |
echo "dist/ before:"
ls dist/
[ -f "./dist/*.egg" ] && "Deleting .egg file as not permitted on PyPI" || rm ./dist/*.egg
echo "dist/ after:"
ls dist/
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit 9c993b8

Please sign in to comment.