From 8e023b5b972f78845842bd8bd4ae08eae55a6ef0 Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Thu, 12 Oct 2023 00:43:23 +0200 Subject: [PATCH] extract branch name --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dce50f..8997d4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,10 +40,15 @@ jobs: IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]') echo ::set-output name=IMAGE_ID::$IMAGE_ID + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + - name: Get the version id: get_version run: | - VERSION="${{ github.ref_name }}" + VERSION="${{ steps.extract_branch.outputs.branch }}" [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') [ "$VERSION" == "main" ] && VERSION=latest echo ::set-output name=VERSION::$VERSION