Skip to content

Commit

Permalink
chore(ci): Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
silvestre committed Aug 22, 2024
1 parent 6b6a7f5 commit e4e036d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/*

23 changes: 11 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -74,4 +74,3 @@ build: clean

test:
@ginkgo .

0 comments on commit e4e036d

Please sign in to comment.