From f1d7c0172e874aa378c07cdb3039f6bc3b9893d0 Mon Sep 17 00:00:00 2001 From: AroneyS Date: Thu, 18 Jan 2024 11:12:37 +1000 Subject: [PATCH 1/2] add citation --- CITATION.cff | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..00dd825 --- /dev/null +++ b/CITATION.cff @@ -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 From 0aea34bfbee9cbf6fcdbfb42d66be7792b5eb8d8 Mon Sep 17 00:00:00 2001 From: AroneyS Date: Thu, 18 Jan 2024 11:33:26 +1000 Subject: [PATCH 2/2] add release script --- galah.yml | 1 + release.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 release.py diff --git a/galah.yml b/galah.yml index f862975..759054f 100644 --- a/galah.yml +++ b/galah.yml @@ -5,3 +5,4 @@ channels: dependencies: - dashing >= 0.4.0 - fastani >= 1.3 + - extern diff --git a/release.py b/release.py new file mode 100644 index 0000000..f7bf1c3 --- /dev/null +++ b/release.py @@ -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")