From b0f5df009aba456f20c60e9dd707725bc446ac4d Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 19:54:59 -0500 Subject: [PATCH 1/6] inject error parsing changes for zenodo release --- .github/workflows/zenodo.yml | 1 + Makefile | 18 ++++++++++++++---- README.rst | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/zenodo.yml b/.github/workflows/zenodo.yml index e6b71af33..04213d4a2 100644 --- a/.github/workflows/zenodo.yml +++ b/.github/workflows/zenodo.yml @@ -35,6 +35,7 @@ jobs: run: | make generate-changes-html VERSION=${{ github.ref_name }} || true echo "ZENODO_DESCRIPTION=$(cat ${{ env.CHANGES_HTML }} | tr -d '\n' || echo '')" >> $GITHUB_ENV + exit 1 - name: Run Zenodo Publish id: deploy_zenodo diff --git a/Makefile b/Makefile index 4ae91606d..2af5243f2 100644 --- a/Makefile +++ b/Makefile @@ -757,7 +757,9 @@ bump: ## bump version using VERSION specified as user input [make VERSION=> 'VERSION' is not set. It is required to extract changes."; exit 1 ) @-echo "Extracting changes for ${VERSION} ..." - @bash -c '\ + ls -la $(APP_ROOT) + ls -la $(REPORTS_DIR) + bash -c '\ START=$$(cat "$(APP_ROOT)/CHANGES.rst" | grep -n "crim-ca/weaver/tree/${VERSION}" | cut -d ":" -f 1); \ STOP=$$(tail -n +$$(($${START:-0} + 2)) "$(APP_ROOT)/CHANGES.rst" \ | grep -n ".. _changes" \ @@ -765,18 +767,26 @@ extract-changes: ## uses the specified VERSION to extract its sub-section in CHA tail -n +$${START:-0} "$(APP_ROOT)/CHANGES.rst" | head -n $${STOP:--1} \ > "$(REPORTS_DIR)/CHANGES_${VERSION}.rst" \ ' + @-echo "Generated changes: $(REPORTS_DIR)/CHANGES_${VERSION}.rst" +# note: +# some text must be inserted before and between the first 'version heading' and the 'changes' sub-heading +# otherwise headers levels are not parsed correctly (they are considered sections all using H1) +# therefore, inject the contents needed to parse as desired, and remove the temp HTML content afterwards .PHONY: generate-changes-html generate-changes-html: extract-changes ## extract CHANGES.rst section as HTML using the specified VERSION @[ "${VERSION}" ] || ( echo ">> 'VERSION' is not set. It is required to extract changes."; exit 1 ) - @-echo "Checking necessary Sphinx dependency ..." - @pip show sphinx >/dev/null || bash -c '$(CONDA_CMD) $(MAKE) -C "$(APP_ROOT)" install-doc' + @-echo "Checking necessary documentation dependency ..." + @which rst2html >/dev/null || bash -c '$(CONDA_CMD) $(MAKE) -C "$(APP_ROOT)" install-doc' @-echo "Converting changes for ${VERSION} ..." @echo '%(body)s' > "$(REPORTS_DIR)/html-body-template.txt" + @sed -i -e 's|Changes:|\\ \n\nChanges:|' "$(REPORTS_DIR)/CHANGES_${VERSION}.rst" + @sed -i -e "s|^\`${VERSION}| \n###\n\n\\ \n\n\`${VERSION}|" "$(REPORTS_DIR)/CHANGES_${VERSION}.rst" @rst2html \ --template "$(REPORTS_DIR)/html-body-template.txt" \ "$(REPORTS_DIR)/CHANGES_${VERSION}.rst" "$(REPORTS_DIR)/CHANGES_${VERSION}.html" - @-echo "Generates changes: $(REPORTS_DIR)/CHANGES_${VERSION}.html" + @sed -i -e 's|

###

||' "$(REPORTS_DIR)/CHANGES_${VERSION}.html" + @-echo "Generated changes: $(REPORTS_DIR)/CHANGES_${VERSION}.html" .PHONY: generate-archive generate-archive: ## generate ZIP and TAR.GZ archives using current contents diff --git a/README.rst b/README.rst index 9113ba3ed..3eab195dc 100644 --- a/README.rst +++ b/README.rst @@ -116,9 +116,9 @@ for each process. :target: https://app.fossa.com/projects/git%2Bgithub.com%2Fcrim-ca%2Fweaver?ref=badge_shield&issueType=license :alt: FOSSA Status -.. |citation-zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.14210718.svg +.. |citation-zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.14210717.svg :alt: Zenodo DOI - :target: https://zenodo.org/doi/10.5281/zenodo.14210718 + :target: https://zenodo.org/doi/10.5281/zenodo.14210717 .. |citation-cff| image:: https://img.shields.io/badge/citation-cff-blue :alt: CFF From 520e460f095d229ee4fcf39318412a7ca059876f Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 19:58:16 -0500 Subject: [PATCH 2/6] tag explicit exclude itself --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 2af5243f2..1f9a85944 100644 --- a/Makefile +++ b/Makefile @@ -799,6 +799,7 @@ generate-archive: ## generate ZIP and TAR.GZ archives using current contents --exclude-vcs-ignores \ --exclude=*.zip \ --exclude=*.tar.gz \ + --exclude="$(APP_NAME)-$(APP_VERSION).tar.gz" \ -cvzf "$(APP_NAME)-$(APP_VERSION).tar.gz" \ --transform 's,^\.,$(APP_NAME)-$(APP_VERSION),' \ . From 89ee37c36f35fb6996f8d9337f36a7deb8f7cd4c Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 20:00:45 -0500 Subject: [PATCH 3/6] add reports dir pre-requirement --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1f9a85944..155643afb 100644 --- a/Makefile +++ b/Makefile @@ -754,11 +754,9 @@ bump: ## bump version using VERSION specified as user input [make VERSION=> 'VERSION' is not set. It is required to extract changes."; exit 1 ) @-echo "Extracting changes for ${VERSION} ..." - ls -la $(APP_ROOT) - ls -la $(REPORTS_DIR) bash -c '\ START=$$(cat "$(APP_ROOT)/CHANGES.rst" | grep -n "crim-ca/weaver/tree/${VERSION}" | cut -d ":" -f 1); \ STOP=$$(tail -n +$$(($${START:-0} + 2)) "$(APP_ROOT)/CHANGES.rst" \ From b87c9bb2a70308d297cf1d4cef3eecc310659fe3 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 20:02:58 -0500 Subject: [PATCH 4/6] reduce CI build time, only need docutils --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 155643afb..d2d81fef7 100644 --- a/Makefile +++ b/Makefile @@ -775,7 +775,7 @@ extract-changes: mkdir-reports ## uses the specified VERSION to extract its sub- generate-changes-html: extract-changes ## extract CHANGES.rst section as HTML using the specified VERSION @[ "${VERSION}" ] || ( echo ">> 'VERSION' is not set. It is required to extract changes."; exit 1 ) @-echo "Checking necessary documentation dependency ..." - @which rst2html >/dev/null || bash -c '$(CONDA_CMD) $(MAKE) -C "$(APP_ROOT)" install-doc' + @which rst2html >/dev/null || pip install docutils @-echo "Converting changes for ${VERSION} ..." @echo '%(body)s' > "$(REPORTS_DIR)/html-body-template.txt" @sed -i -e 's|Changes:|\\ \n\nChanges:|' "$(REPORTS_DIR)/CHANGES_${VERSION}.rst" From f451a6244c3a3783319ace22fd3eab861f0735b1 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 20:03:58 -0500 Subject: [PATCH 5/6] preview HTML --- .github/workflows/zenodo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/zenodo.yml b/.github/workflows/zenodo.yml index 04213d4a2..6a088fdd2 100644 --- a/.github/workflows/zenodo.yml +++ b/.github/workflows/zenodo.yml @@ -35,6 +35,7 @@ jobs: run: | make generate-changes-html VERSION=${{ github.ref_name }} || true echo "ZENODO_DESCRIPTION=$(cat ${{ env.CHANGES_HTML }} | tr -d '\n' || echo '')" >> $GITHUB_ENV + cat ${{ env.CHANGES_HTML }} exit 1 - name: Run Zenodo Publish From a70d9db139e4c1e41984508a67a1d5072319fc65 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Tue, 3 Dec 2024 20:05:26 -0500 Subject: [PATCH 6/6] remove exit code from CI - HTML ready --- .github/workflows/zenodo.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/zenodo.yml b/.github/workflows/zenodo.yml index 6a088fdd2..42f43640f 100644 --- a/.github/workflows/zenodo.yml +++ b/.github/workflows/zenodo.yml @@ -36,7 +36,6 @@ jobs: make generate-changes-html VERSION=${{ github.ref_name }} || true echo "ZENODO_DESCRIPTION=$(cat ${{ env.CHANGES_HTML }} | tr -d '\n' || echo '')" >> $GITHUB_ENV cat ${{ env.CHANGES_HTML }} - exit 1 - name: Run Zenodo Publish id: deploy_zenodo