From 8db9441e046b57cf1483a27d08941baad7d3a6c3 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 26 Mar 2024 11:55:34 +0100 Subject: [PATCH] release script: add post-release.py --- scripts/python/post-release.py | 89 +++++++++++++++++++ .../procedures/publish-a-release/index.md | 11 +-- 2 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 scripts/python/post-release.py diff --git a/scripts/python/post-release.py b/scripts/python/post-release.py new file mode 100644 index 00000000000..d34c20c2097 --- /dev/null +++ b/scripts/python/post-release.py @@ -0,0 +1,89 @@ +import re +import subprocess +from pathlib import Path + +script_path = Path(__file__).resolve() +source_path = script_path.parent.parent.parent.resolve() + +r = subprocess.run( + "curl https://zenodo.org/doi/10.5281/zenodo.591265", + shell=True, + check=True, + capture_output=True, + text=True, +) + +zenodo_record = re.search(r'"https://zenodo.org/records/([0-9]+)"', r.stdout).group(1) +print(f"Zenodo record: {zenodo_record}") + +print("Issuing scan on Software Heritage ...") +r = subprocess.run( + "curl -X POST https://archive.softwareheritage.org/api/1/origin/save/git/url/https://gitlab.opengeosys.org/ogs/ogs.git/", + shell=True, + check=True, +) + +print("\n\nUpdating bibtex entry on website ...") +r = subprocess.run( + f"curl https://zenodo.org/records/{zenodo_record}/export/bibtex", + shell=True, + check=True, + capture_output=True, + text=True, +) + +bibtex = r.stdout + +m = re.search(r"\{([0-9]+\.[0-9]+\.[0-9]+)\}", bibtex) +version = m.group(1) + +bibtex = re.sub(r"@software\{.*,\n", f"@software{{ogs:{version},\n", bibtex) + +publications_index_page = "" +with (source_path / "web/content/publications/_index.md").open() as f: + publications_index_page = f.read() + +publications_index_page = re.sub( + r"(?s)```bibtex.*```", f"```bibtex\n{bibtex}\n```", publications_index_page +) + +with (source_path / "web/content/publications/_index.md").open("w") as f: + f.write(publications_index_page) + +r = subprocess.run( + f"curl -s https://gitlab.opengeosys.org/api/v4/projects/120/releases/{version} | jq '.description'", + shell=True, + check=True, + text=True, + capture_output=True, +) +changelog = r.stdout[1:-2].replace(r"\n", "\n").replace(r"\"", '"') + +print( + f"""Add to CITATION.cff: + +``` +identifiers: + - type: doi + value: 10.5281/zenodo.{zenodo_record} + description: Zenodo DOI for {version} +``` + +Commit and push to master and create Zenodo release post: + +[](https://doi.org/10.5281/zenodo.{zenodo_record}) + +We are happy to announce the release of **OpenGeoSys {version}**! + +## Links + +- [Release page on www.opengeosys.org](https://www.opengeosys.org/releases/{version}/) +- [GitLab Release](https://gitlab.opengeosys.org/ogs/ogs/-/releases/{version}) +- [Zenodo Release](https://zenodo.org/record/{zenodo_record}) +- [PyPI Release](https://pypi.org/project/ogs/{version}/) + +## Highlights + +{changelog} +""" +) diff --git a/web/content/docs/devguide/procedures/publish-a-release/index.md b/web/content/docs/devguide/procedures/publish-a-release/index.md index c815fa4487f..e640222840d 100644 --- a/web/content/docs/devguide/procedures/publish-a-release/index.md +++ b/web/content/docs/devguide/procedures/publish-a-release/index.md @@ -20,15 +20,6 @@ weight = 1080 - Copy release binaries and container images from CI job to Azure OGS storage to a subdirectory containing the tag name at <https://ogsstorage.blob.core.windows.net/binaries/ogs6> - Create a release on GitHub mirror (`ufz/ogs`) - Check if a [Zenodo release](https://zenodo.org/account/settings/github/repository/ufz/ogs#) is automatically issued -- Issue a scan on Software Heritage: `curl -X POST https://archive.softwareheritage.org/api/1/origin/save/git/url/https://gitlab.opengeosys.org/ogs/ogs.git/` -- Update `CITATION.cff` and `web/content/publications/_index.md` with new Zenodo DOI -- Update `CITATION.cff` author list (`git shortlog -sne 6.4.3...6.4.2`) and corresponding bibtex-entry in publications web page, TODO: download BibTex entry and copy to web page, e.g. https://zenodo.org/records/2600042/export/bibtex +- Run `python scripts/python/post-release.py` and commit and create a discourse announcement post - Update Zenodo entry with correct authors -- Create a discourse announcement post - - DOI badge - - Software heritage badge - - Link to release page on opengeosys.org - - Link to GitLab release - - Link to Zenodo release - - Link to archive on Software Heritage - Set milestone on expired issues and merge requests -- GitLab