Skip to content

How to: create a release

Ludovico Bianchi edited this page Jun 28, 2022 · 2 revisions

Set version tag

Uses a variant of CalVer, e.g. for releases on June 24th, 2022:

  • The first release is 22.06.24
  • The second release is 22.06.24.1, and so on
tag="YY.MM.DD.N"

Create a GitHub release

set -o nounset
gh release create "$tag" \
--repo "gmlc-dispatches/sample-data" \
--target "main" \
--title "$tag" \
--prerelease \
--draft

Create a PyPI package distribution

set -o nounset
build_env="build-sample-data-$tag"
conda create -n "$build_env" python=3.9 twine wheel pip --yes && conda activate "$build_env"
pushd "$(mktemp -d)"
gh repo clone "gmlc-dispatches/sample-data" && cd sample-data && echo "$PWD"
git checkout "$tag"
pip install .
rm -rf dist/ build/ *.egg-info
python setup.py build sdist bdist_wheel

# verify that the ~/.pypirc config file exists
# and defines the "testpypi" and "realpypi" repository
grep "\[testpypi\]" ~/.pypirc && twine upload --repository testpypi dist/*
grep "\[realpypi\]" ~/.pypirc && twine upload --repository realpypi dist/*

conda deactivate && conda env remove -n "$build_env"
popd
Clone this wiki locally