Skip to content

Commit

Permalink
use GITHUB_ACTION_TAG env
Browse files Browse the repository at this point in the history
Signed-off-by: galal-hussein <[email protected]>
  • Loading branch information
galal-hussein committed Jun 21, 2024
1 parent f9e2c18 commit 554be63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

env:
GH_TOKEN: ${{ github.token }}
GITHUB_ACTION_TAG: ${{ github.ref_name }}

name: Release
permissions:
Expand Down
21 changes: 11 additions & 10 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/bin/bash

if [ -n "$DRONE_TAG" ]; then
VERSION="$DRONE_TAG"
else
git fetch --tags &>/dev/null || true
GIT_TAG=$(git describe --tags --dirty 2>/dev/null)
if [ -n "$GIT_TAG" ]; then
VERSION="$GIT_TAG"
else
VERSION="v0.0.0-$(git describe --always --dirty)"
fi
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DIRTY="-dirty"
fi

COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=${GITHUB_ACTION_TAG:-$(git tag -l --contains HEAD | head -n 1)}

if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
VERSION=$GIT_TAG
else
VERSION="${COMMIT}${DIRTY}"
fi

if [ -z "$ARCH" ]; then
Expand Down

0 comments on commit 554be63

Please sign in to comment.