From f319f573feff5f79f6c0b139b4d1aba4b3c1bb71 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Thu, 25 Jul 2024 16:35:22 -0700 Subject: [PATCH] get version --- .github/workflows/devops-test.yaml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/devops-test.yaml b/.github/workflows/devops-test.yaml index f67143cfc..8e802d64c 100644 --- a/.github/workflows/devops-test.yaml +++ b/.github/workflows/devops-test.yaml @@ -7,13 +7,31 @@ on: jobs: + get-version: + name: Retrieve version + runs-on: ubuntu-latest + + outputs: + output1: ${{ steps.get-version.outputs.VERSION }} + + steps: + - id: get-version + run: | + default-release=${{ github.event.repository.default_branch }} + version=$(echo "$default-release" | sed -E 's/release-(.*)/\1/') + echo "VERSION=$version" >> $GITHUB_OUTPUT + devops-test: name: Devops test runs-on: ubuntu-latest + needs: [get-version] + + env: + VERSION: ${{ needs.get-version.outputs.output1 }} steps: - - name: print default branch name + - name: print version run: | - echo "The default branch is ${{ github.event.repository.default_branch }}" \ No newline at end of file + echo "The default branch is ${{ env.VERSION }}" \ No newline at end of file