diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ea24bae --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release +permissions: + contents: write +on: workflow_dispatch + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install devbox + uses: jetify-com/devbox-install-action@a03caf5813591bc882139eba6ae947930a83a427 # v0.11.0 + with: + enable-cache: 'true' + - name: Build release + run: | + devbox run make SEMVER_PRERELEASE=release + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: build/* + diff --git a/Makefile b/Makefile index bebb7fb..0719553 100644 --- a/Makefile +++ b/Makefile @@ -19,23 +19,23 @@ SEMVER_MAJOR_VERSION ?=3 SEMVER_MINOR_VERSION ?=0 SEMVER_PATCH_VERSION ?=1 SEMVER_PRERELEASE ?= dev -SEMVER_BUILDMETA ?= +0 +SEMVER_BUILDMETA ?= 0 BUILD_DATE :=$(shell date -u -Iseconds) BUILD_VCS_URL :=$(shell git config --get remote.origin.url) BUILD_VCS_ID :=$(shell git log -n 1 --date=iso-strict-local --format="%h") BUILD_VCS_ID_DATE :=$(shell TZ=UTC0 git log -n 1 --date=iso-strict-local --format='%ad') -FILE_BUILD_VERSION :=$(SEMVER_VERSION)$(SEMVER_PRERELEASE)$(SEMVER_BUILDMETA) +FILE_BUILD_VERSION :=$(SEMVER_MAJOR_VERSION).${SEMVER_MINOR_VERSION}.${SEMVER_PATCH_VERSION}-$(SEMVER_PRERELEASE)+$(SEMVER_BUILDMETA) GO_LDFLAGS = -ldflags="$(BUILDFLAGS) \ - -X '$(GOMODULECMD).BuildMajorVersion=$(SEMVER_MAJOR_VERSION)' \ - -X '$(GOMODULECMD).BuildMinorVersion=$(SEMVER_MINOR_VERSION)' \ - -X '$(GOMODULECMD).BuildPatchVersion=$(SEMVER_PATCH_VERSION)' \ - -X '$(GOMODULECMD).BuildPrerelease=$(SEMVER_PRERELEASE)' \ - -X '$(GOMODULECMD).BuildMeta=$(SEMVER_BUILDMETA)' \ - -X '$(GOMODULECMD).BuildDate=$(BUILD_DATE)' \ - -X '$(GOMODULECMD).BuildVcsUrl=$(BUILD_VCS_URL)' \ - -X '$(GOMODULECMD).BuildVcsId=$(BUILD_VCS_ID)' \ - -X '$(GOMODULECMD).BuildVcsIdDate=$(BUILD_VCS_ID_DATE)'" + -X '$(GOMODULECMD).BuildMajorVersion=$(SEMVER_MAJOR_VERSION)' \ + -X '$(GOMODULECMD).BuildMinorVersion=$(SEMVER_MINOR_VERSION)' \ + -X '$(GOMODULECMD).BuildPatchVersion=$(SEMVER_PATCH_VERSION)' \ + -X '$(GOMODULECMD).BuildPrerelease=$(SEMVER_PRERELEASE)' \ + -X '$(GOMODULECMD).BuildMeta=$(SEMVER_BUILDMETA)' \ + -X '$(GOMODULECMD).BuildDate=$(BUILD_DATE)' \ + -X '$(GOMODULECMD).BuildVcsUrl=$(BUILD_VCS_URL)' \ + -X '$(GOMODULECMD).BuildVcsId=$(BUILD_VCS_ID)' \ + -X '$(GOMODULECMD).BuildVcsIdDate=$(BUILD_VCS_ID_DATE)'" test_dirs=$(shell find . -name "*_test.go" -exec dirname {} \; | cut -d/ -f2 | sort | uniq) @@ -74,4 +74,3 @@ build: clean test: @ginkgo . -