From ba10e891819a6f481d854bde74b94454c68c3192 Mon Sep 17 00:00:00 2001 From: Louis Beaumont Date: Wed, 31 Jul 2024 09:35:09 +0200 Subject: [PATCH] fix: ci --- .github/workflows/release-cli.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index c0c608b0..df860dab 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -48,7 +48,7 @@ jobs: - uses: actions/cache@v3 with: - path: | + path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ @@ -64,13 +64,16 @@ jobs: # get the current tag or take latest (in the case of a workflow dispatch) - name: Set version run: | - VERSION=${GITHUB_REF#refs/tags/} - if [[ $VERSION != v* ]]; then - git fetch --tags - VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/v} + else + VERSION=$(git ls-remote --tags --refs --sort="version:refname" | tail -n1 | sed 's/.*\///' | sed 's/^v//') + fi + if [[ -z "$VERSION" ]]; then + VERSION="0.0.0" fi - VERSION=${VERSION#v} echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Set version to: $VERSION" - name: Create deployment package run: |