diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 8b420fdfa98..d8687e0e48e 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -21,6 +21,8 @@ jobs: id-token: write attestations: write contents: write + outputs: + conda-forge-version: ${{ steps.check-tag.outputs.conda-forge-version }} defaults: run: shell: bash -l {0} @@ -111,6 +113,9 @@ jobs: # Output to later steps echo "create-release=true" >> $GITHUB_OUTPUT echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT + # Expose the version for the conda-forge feedstock, skipping pre-releases + CONDA_FORGE_VERSION=$(python -c $'from packaging.version import Version; v = Version('"'$NEW_VERSION'"$')\nprint("" if v.is_prerelease else v)') + echo "conda-forge-version=$CONDA_FORGE_VERSION" >> $GITHUB_OUTPUT fi fi fi @@ -189,3 +194,20 @@ jobs: uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true + + update-conda-forge: + name: conda-forge feedstock update + runs-on: "ubuntu-latest" + needs: deploy-pypi + if: needs.deploy-pypi.outputs.conda-forge-version != '' + environment: conda-forge + steps: + - name: Update the dirac-grid feedstock + uses: conda-forge/release@45b05fddc6addd06d5f982ebe0a88378ec44de92 # v2026.9.15 + with: + feedstock: dirac-grid-feedstock + feedstock-branch: v9.0.x + version: ${{ needs.deploy-pypi.outputs.conda-forge-version }} + github-token: ${{ secrets.CONDA_FORGE_PAT }} + github-token-for-fork: ${{ secrets.CONDA_FORGE_FORK_PAT }} + automerge: true diff --git a/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py b/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py index bfe360b8050..5141a60e48d 100755 --- a/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py +++ b/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py @@ -504,26 +504,35 @@ def getGithubLatestTagDate(self, sinceTag): """ log = LOGGER.getChild("getGithubLatestTagDate") - # Get all tags - tags = req2Json(url=self._github("tags"), queryParameters={"per_page": 100}) - if isinstance(tags, dict) and "Not Found" in tags.get("message"): - raise RuntimeError(f"Package not found: {str(self)}") - if sinceTag: - for tag in tags: - if tag["name"] == sinceTag: - latestTag = tag + # Look the tag up directly as there are more tags than fit in a single page of + # the "tags" endpoint. This matches any tag starting with sinceTag so the exact + # match still has to be picked out of the results. + refs = req2Json(url=self._github(f"git/matching-refs/tags/{sinceTag}"), queryParameters={"per_page": 100}) + for ref in refs: + if ref["ref"] == f"refs/tags/{sinceTag}": break else: raise ValueError(f"Tag {sinceTag} not found") + latestTagName = sinceTag + latestTagCommitSha = ref["object"]["sha"] + if ref["object"]["type"] == "tag": + # Annotated tags have to be dereferenced to find the commit they point at + tagInfo = req2Json(url=self._github(f"git/tags/{latestTagCommitSha}")) + latestTagCommitSha = tagInfo["object"]["sha"] else: + # Get all tags + tags = req2Json(url=self._github("tags"), queryParameters={"per_page": 100}) + if isinstance(tags, dict) and "Not Found" in tags.get("message"): + raise RuntimeError(f"Package not found: {str(self)}") + sortedTags = sorted(tags, key=lambda tag: LooseVersion(tag["name"]), reverse=True) - latestTag = sortedTags[0] + latestTagName = sortedTags[0]["name"] + latestTagCommitSha = sortedTags[0]["commit"]["sha"] - log.info("Found latest tag %s", latestTag["name"]) + log.info("Found latest tag %s", latestTagName) # Use the sha of the commit to finally retrieve the date - latestTagCommitSha = latestTag["commit"]["sha"] commitInfo = req2Json(url=self._github(f"git/commits/{latestTagCommitSha}")) startDate = dateutil.parser.isoparse(commitInfo["committer"]["date"])