From 3e804623ceab6f15d192413dc2c41699670ab31c Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 31 Oct 2024 16:19:14 -0600 Subject: [PATCH] CI: Make version finding more flexible Use repository name rather than hard-coding MetPy, which allows this action to be re-used in Siphon. Also print out the value since this is often needed in debugging. --- .github/actions/build-docs/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index bf9ed508b2..2a666c2daf 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -27,7 +27,11 @@ runs: - name: Set doc version id: docversion shell: bash -l {0} - run: echo "doc_version=$(python -c 'import metpy,re; print(re.search(r"(\d+\.\d+)", metpy.__version__)[0])')" >> $GITHUB_OUTPUT + run: echo "doc_version=$(python -c 'import importlib.metadata,os,re; print(re.search(r"(\d+\.\d+)", importlib.metadata.version(os.environ["GITHUB_REPOSITORY"].split("/")[-1].lower()))[0])')" >> $GITHUB_OUTPUT + + - name: Show doc version + shell: bash -l {0} + run: echo Building docs for version ${{ steps.docversion.outputs.doc_version }} - name: Build docs shell: bash -l {0}