Skip to content

Commit

Permalink
Create publish.yml
Browse files Browse the repository at this point in the history
This GitHub Action builds wheels and sdists and pushes them to GitHub's releases page and PyPI. All you have to do is go to [New Release](https://github.com/voxelmorph/voxelmorph/releases/new), fill in a version tag like "v0.9.1", click Publish, and a couple minutes later the .whl and .tar.gz will be up on [Releases](https://github.com/voxelmorph/voxelmorph/releases) and on [PyPI](https://pypi.org/project/voxelmorph).

To get PyPI working as well, [get a PyPI token](https://pypi.org/manage/account/token/), give it to GitHub [here](https://github.com/voxelmorph/voxelmorph/settings/secrets/actions) named `PYPI_TOKEN`.

Fixes voxelmorph#432
  • Loading branch information
kousu committed May 17, 2022
1 parent bcdd713 commit babc17f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ref: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish Package

on:
# publish from the Releases page:
release:
types: [published]

jobs:
publish:
name: Publish Package

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build
run: python -m build

- name: Publish to Github
uses: softprops/action-gh-release@v1
with:
files: 'dist/*'
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'dev') }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit babc17f

Please sign in to comment.