How to Release a New Package¶
CoastSeg has a github action that publishes a new pypi package if the commit is tagged with the version number of the package to release on pypi. To ensure a consistent and smooth package release process, follow this step-by-step guide. The release procedure centers around tagging the commit properly.
Release Steps¶
-
Ensure your local branch is up-to-date with the main branch.
1
git pull origin main
-
Commit your all changes.
1
git commit -m "<explain changes"
-
Modify the
pyproject.toml
file with the new version number -
Under the
[project]
section change theversion = ""
to the new version -
Example: to release version 1.2.6 I would write
version = "1.2.6"
1 2 3 4 5 6 7 |
|
-
Commit the modified
pyproject.toml
file. -
In this commit only include the changed
pyproject.toml
file -
This makes is easy to track different versions
1
git commit -m "Release v1.0.3" # Replace with your version number
-
To tag the most recent commit, simply use:
-
See the tagging format guide below to learn how to format the tags
-
The expected format is
v<version_number>
so for version 1.0.3 it would bev1.0.3
1
git tag v1.0.3
-
Alternatively, if you need to tag a specific commit (other than the most recent one), first find the commit's hash using:
1
git log --oneline
This will display a list of recent commits with their shortened hash. Identify the commit you want to tag, then tag it using:
1
git tag v1.0.3 COMMIT_HASH # Replace with your version number and the appropriate commit hash
-
Push the commit to the repository.
- This will trigger tests to run automatically in the Actions tab in the CoastSeg repository.
1
git push origin main
-
Push the tag to the repository.
- This will trigger an action called "Publish Package to PyPi", which will automatically release the package on pypi, then later trigger the conda package to be released.
1
git push origin v1.0.3 # Replace with your version number
-
Release the Conda Package
-
Visit the CoastSeg conda-forge feedstock
-
The bots at the CoastSeg conda-forge feedstock will scan pypi for the new coastseg release and when it finds a new release it will open a pull request with the new version number
-
Merge the new Pull Request on the conda forge feedstock and the bots will automatically release a new version
-
Tagging Format¶
When you're ready to release a new package, push a commit with a tag that matches one of the following formats:
-
Major, minor, and patch versions:
v[0-9]+.[0-9]+.[0-9]+
-
Example:
v1.0.3
-
Alpha versions:
v[0-9]+.[0-9]+.[0-9]+a[0-9]+
-
Beta versions:
v[0-9]+.[0-9]+.[0-9]+b[0-9]+
-
Release candidate versions:
v[0-9]+.[0-9]+.[0-9]+rc[0-9]+
-
Development versions:
v[0-9]+.[0-9]+.[0-9]+dev[0-9]+
- Example:
v1.2.0dev1
✅ Good Tag Names¶
- v1.0.3
- v1.2.0dev1
❌ Bad Tag Names¶
- 1.2.0 : Missing the "v"