From fe33ec5cf03ad781a11b0c73292dd086a95e34aa Mon Sep 17 00:00:00 2001 From: Justin Bassett Date: Tue, 8 Dec 2020 00:16:47 -0800 Subject: [PATCH] Get correct version on release in Conan packaging $GITHUB_REF starts with refs/tags/, which we need to remove. Additionally, our versioning convention is to start versions with a v, which prefix needs to be removed. --- .github/workflows/conan.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 1464e8e..b82567c 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -25,9 +25,14 @@ jobs: shell: python run: | import os + import re if '${{ github.event_name }}' == 'release': - print('::set-output name=CONAN_VERSION::' + os.environ['GITHUB_REF']) + ref = os.environ['GITHUB_REF'] + assert ref.startswith('refs/tags/v') + version = ref[len('refs/tags/v'):] + assert re.match(r'\d+\.\d+\.\d+', version) + print('::set-output name=CONAN_VERSION::' + version) print('::set-output name=CONAN_CHANNEL::stable') else: assert '${{ github.event_name }}' == 'push'