From aa0b9fc032c62565bbca737ad8995db501366320 Mon Sep 17 00:00:00 2001 From: Chris Dzombak Date: Thu, 30 May 2024 08:53:00 -0400 Subject: [PATCH] fix versioning --- .github/workflows/main.yml | 4 ++-- .version.sh | 8 ++++++++ Makefile | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 .version.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 841511b..4c8285f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -171,7 +171,7 @@ jobs: homebrew: name: Update Homebrew Tap - needs: [meta, binaries] + needs: [meta, binaries, release] if: needs.meta.outputs.is_release == 'true' runs-on: ubuntu-latest steps: @@ -191,7 +191,7 @@ jobs: target_linux_arm64: false version: v${{ needs.meta.outputs.bin_version }} install: 'bin.install "${{ needs.meta.outputs.bin_name }}"' - test: 'assert_match("${{ needs.meta.outputs.bin_version }}", shell_output("#{bin}/${{ needs.meta.outputs.bin_name }} -version"))' + test: 'assert_match("${{ needs.meta.outputs.bin_version }}", shell_output("#{bin}/${{ needs.meta.outputs.bin_name }} version"))' ntfy: name: Ntfy diff --git a/.version.sh b/.version.sh new file mode 100755 index 0000000..fcad9c8 --- /dev/null +++ b/.version.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ -z "$(git tag --points-at HEAD)" ]; then + git describe --always --long --dirty | sed 's/^v//' +else + git tag --points-at HEAD | sed 's/^v//' | awk '{ print length, $0 }' | sort -n -s | cut -d" " -f2- | tail -n 1 +fi diff --git a/Makefile b/Makefile index 705a4be..56621bc 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ SHELL:=/usr/bin/env bash -BIN_VERSION:=$(shell [ -z "$$(git tag --points-at HEAD)" ] && echo "$$(git describe --always --long --dirty | sed 's/^v//')" || echo "$$(git tag --points-at HEAD | sed 's/^v//')") -X3F_EXTRACT_VERSION:=$(shell ./x3f_extract 2>/dev/null | grep -i "VERSION =" | rev | cut -d' ' -f1 | rev) BIN_NAME:=xtool +BIN_VERSION:=$(shell ./.version.sh) +X3F_EXTRACT_VERSION:=$(shell ./x3f_extract 2>/dev/null | grep -i "VERSION =" | rev | cut -d' ' -f1 | rev) default: help .PHONY: help