Skip to content

Publish to PyPI

Publish to PyPI #22

Workflow file for this run

# This workflows will upload a Python Package using Twine when a release is published
# Based on https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Publish to PyPI
on:
push:
tags: # Sequence of patterns matched against refs/tags
- 'v*' # Any tag matching v*, e.g. v1.0, v1.2b1
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_JM }}
run: |
python -c 'import python.snewpy; python.snewpy._get_model_urls()'
cat python/snewpy/_model_urls.py
pip install .
python -c 'import snewpy; snewpy.get_models(models="Bollig_2016")'
rm -r SNEWPY_models/
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Get Version Number
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Draft Release
# Go to https://github.com/SNEWS2/snewpy/releases to edit this draft release and publish it
# Once it is published, the release automatically is pushed to Zenodo: https://doi.org/10.5281/zenodo.4498940
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
body: |
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4498940.svg)](https://doi.org/10.5281/zenodo.4498940)
(TODO: This DOI always points to the latest version. Replace it with the DOI for this specific release!)
List major changes since the last release here: newly added models, new features, etc.
If necessary, also list breaking changes: removed features, renamed command line options, new minimum Python version, etc.
draft: true
prerelease: false