Skip to content

Commit d36db6d

Browse files
committed
For new releases, build a Python package and host it on PyPI
1 parent f885791 commit d36db6d

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build and deploy PyPI package
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
pypi-publish:
8+
name: Publish release to PyPI
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: pypi
12+
url: https://pypi.org/project/bidscoin
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.x"
21+
- name: Remove raw HTML block from README.rst
22+
run: |
23+
run: sed -i '/^\.\. raw:: html/ {N;N;N;d;}' README.rst
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install setuptools wheel build
28+
- name: Build package
29+
run: |
30+
python -m build
31+
- name: Publish package distributions to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1

release_procedure.rst

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -60,38 +60,7 @@ DCCN deployment
6060
GitHub
6161
------
6262

63-
1. Publish a new release
64-
65-
Pypi
66-
----
67-
68-
1. Temporarily remove the raw html logo markup
69-
2. Build and upload the new release::
70-
71-
conda deactivate
72-
source activate tox
73-
cd ~/python/bidscoin
74-
git checkout master
75-
rm dist/*
76-
python3 -m pip install --upgrade build twine
77-
python3 -m build
78-
python3 -m twine upload --repository testpypi dist/*
79-
python3 -m twine upload dist/*
80-
81-
3. Restore raw html logo markup
82-
83-
Dockerhub
84-
---------
85-
86-
1. In the VM, build, test and push a Docker image::
87-
88-
VERSION="4.5.0"
89-
cd ~/PycharmProjects/bidscoin
90-
sudo docker build -t marcelzwiers/bidscoin:$VERSION .
91-
sudo docker run --rm marcelzwiers/bidscoin:$VERSION bidscoin -v
92-
sudo docker run --rm marcelzwiers/bidscoin:$VERSION pngappend
93-
sudo docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix marcelzwiers/bidscoin:$VERSION bidscoin -t
94-
sudo docker push marcelzwiers/bidscoin:$VERSION
63+
Publish a new release. This will trigger GitHub Actions for publishing on PyPI, GHCR and DockerHub
9564

9665
Neurodesk
9766
---------

0 commit comments

Comments
 (0)