Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add citations and release #41

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Aroney
given-names: Samuel T. N.
orcid: https://orcid.org/0000-0001-9806-5846
- family-names: Camargo
given-names: Antonio P.
orcid: https://orcid.org/0000-0003-3913-2484
- family-names: Tyson
given-names: Gene W.
orcid: https://orcid.org/0000-0001-8559-9427
- family-names: Woodcroft
given-names: Ben J.
orcid: https://orcid.org/0000-0003-0670-7480
title: "Galah: More scalable dereplication for metagenome assembled genomes"
version: 0.3.1
date-released: 2021-11-30
1 change: 1 addition & 0 deletions galah.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ channels:
dependencies:
- dashing >= 0.4.0
- fastani >= 1.3
- extern
44 changes: 44 additions & 0 deletions release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

import io
from os.path import dirname, join
import extern

def get_version(relpath):
"""Read version info from a file without importing it"""
for line in io.open(join(dirname(__file__), relpath), encoding="utf-8"):
if "version" in line:
if '"' in line:
return line.split('"')[1]
elif "'" in line:
return line.split("'")[1]

if __name__ == "__main__":
print("running release.sh")
extern.run("release.sh")

version = get_version('Cargo.toml')
print("version is {}".format(version))

# Replace version in CITATION.cff
citations_lines = []
with open("CITATION.cff", "r") as f:
import re
r = re.compile(r"( *version: )")
r2 = re.compile(r"( *date-released: )")
for line in f:
if matches := r.match(line):
line = matches.group(1) + version + "\n"
elif matches := r2.match(line):
from datetime import datetime
line = matches.group(1) + datetime.today().strftime('%Y-%m-%d') + "\n"
citations_lines.append(line)
with open("CITATION.cff", "w") as f:
f.writelines(citations_lines)

print("Checking if repo is clean ..")
extern.run('if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then exit 1; fi')

extern.run('git tag v{}'.format(version))
print("Now run 'cargo publish' and then 'git push && git push --tags' and GitHub actions will build and upload to PyPI".format(version))
print("Then make a release, adding changelog info, so Zenodo picks it up")
Loading