From f9e2c18f7121c0cb85d3ec0ca9c431e49533db4e Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Sat, 22 Jun 2024 00:18:29 +0300 Subject: [PATCH 1/2] Use gh tool to upload artifacts Signed-off-by: galal-hussein --- .github/workflows/release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9980d73..002159b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,9 @@ on: tags: - "v*" +env: + GH_TOKEN: ${{ github.token }} + name: Release permissions: contents: write @@ -21,10 +24,6 @@ jobs: CROSS: "true" - name: release binaries - uses: softprops/action-gh-release@v2 - with: - files: | - dist/artifacts/* - - + run: | + gh release upload ${{ github.ref_name }} dist/artifacts/* \ No newline at end of file From 554be6387f58dc9e32f7999edba31c8b76309be0 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Sat, 22 Jun 2024 01:02:41 +0300 Subject: [PATCH 2/2] use GITHUB_ACTION_TAG env Signed-off-by: galal-hussein --- .github/workflows/release.yml | 1 + scripts/version.sh | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 002159b..6bf253a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: env: GH_TOKEN: ${{ github.token }} + GITHUB_ACTION_TAG: ${{ github.ref_name }} name: Release permissions: diff --git a/scripts/version.sh b/scripts/version.sh index d46f6af..b8d5eda 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -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