Skip to content

Commit

Permalink
Release with gh tag
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN committed Dec 5, 2024
1 parent 18ca60d commit 7637761
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish release
on:
push:
tags:
- "*.*.*"
jobs:
publish-release:
if: startsWith(github.ref, 'refs/tags/')
name: "Publish release"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.23.x
- name: Checkout
uses: actions/[email protected]
with:
#token: ${{ secrets.GH_PAT }}
- name: Build Release
run: make -j4 build_all
- name: Publish to Github
uses: softprops/action-gh-release@v2
with:
#token: ${{ secrets.GH_PAT }}
files: ./bin/*
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
VERSION := $(shell git describe --tags --dirty --always)
LDFLAGS = -ldflags "-X main.Version=${VERSION}"
SOURCES := $(shell find $(SOURCEDIR) -name '*.go' ! -name '*_test.go')
SOURCES := $(shell find $(SOURCEDIR) -name '*.go' ! -name '*_test.go' ! -path '$(SOURCEDIR)/vendor/*')

build:
CGO_ENABLED=0 go build ${LDFLAGS} .

build_all: bin/narr-amd64-linux bin/narr-amd64-darwin bin/narr-amd64-windows.exe bin/narr-arm64-darwin

bin/narr-amd64-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-linux $(SOURCES)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-linux

bin/narr-amd64-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-darwin $(SOURCES)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-darwin

bin/narr-amd64-windows.exe:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-windows.exe $(SOURCES)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-windows.exe

bin/narr-arm64-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o bin/narr-arm64-darwin $(SOURCES)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o bin/narr-arm64-darwin

.PHONY: test
test:
Expand Down

0 comments on commit 7637761

Please sign in to comment.