diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index d182bc9..4ccf1d6 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -12,7 +12,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Get current Version + id: version + run: | + if [[ "${{ github.ref_type }}" = "tag" ]]; then + echo "version=$(echo ${{ github.ref }} | sed "s/^.*\/v//g")" >> $GITHUB_OUTPUT + else + echo "Ref Type not tag: ${{github.ref_type}}" + echo "latest" >> $GITHUB_OUTPUT + fi - name: shellcheck run: shellcheck telegraf/run.sh - name: Login to GitHub Container Registry diff --git a/.github/workflows/copy-config.yml b/.github/workflows/copy-config.yml index ebbd79c..edebf0c 100644 --- a/.github/workflows/copy-config.yml +++ b/.github/workflows/copy-config.yml @@ -46,8 +46,7 @@ jobs: id: version run: | if [[ "${{ github.ref_type }}" = "tag" ]]; then - TAG=${{ github.ref }} - echo "version=${TAG#v}" >> $GITHUB_OUTPUT + echo "version=$(echo ${{ github.ref }} | sed "s/^.*\/v//g")" >> $GITHUB_OUTPUT else echo "Ref Type not tag: ${{github.ref_type}}" echo "latest" >> $GITHUB_OUTPUT