-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b698223
commit fcc8e27
Showing
6 changed files
with
95 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checking out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setting up Go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Running GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
default: all | ||
GIT_SHA := $(shell git rev-parse --short HEAD) | ||
DATE := $(shell date "+%Y-%m-%dT%H:%M:%SZ") | ||
USER := $(shell id -un) | ||
VERSION := $(shell git describe --tags --abbrev=0) | ||
|
||
all: clean build | ||
|
||
|
@@ -8,10 +11,7 @@ test: | |
go test `go list ./... | grep -v maxmind | grep -v discvx` | ||
|
||
build: | ||
go build -ldflags "-X main.RawVersion=`cat version`" -o dist/nebula github.com/dennis-tra/nebula-crawler/cmd/nebula | ||
|
||
build-linux: | ||
GOOS=linux GOARCH=amd64 make build | ||
go build -ldflags "-X main.version=${VERSION} -X main.commit=${GIT_SHA} -X main.date=${DATE} -X main.builtBy=${USER}" -o dist/nebula github.com/dennis-tra/nebula-crawler/cmd/nebula | ||
|
||
format: | ||
gofumpt -w -l . | ||
|
@@ -20,13 +20,13 @@ clean: | |
rm -r dist || true | ||
|
||
docker: | ||
docker build -t dennistra/nebula:latest -t dennistra/nebula:`cat version` . | ||
docker build -t dennistra/nebula:latest -t dennistra/nebula:${GIT_SHA} . | ||
|
||
docker-linux: | ||
docker build --platform linux/amd64 -t 019120760881.dkr.ecr.us-east-1.amazonaws.com/probelab:nebula-sha6bc3e96 . | ||
docker build --platform linux/amd64 -t 019120760881.dkr.ecr.us-east-1.amazonaws.com/probelab:nebula-sha${GIT_SHA} . | ||
|
||
docker-push: docker-linux | ||
docker push dennistra/nebula:latest dennistra/nebula:`cat version` | ||
docker push dennistra/nebula:latest dennistra/nebula:${GIT_SHA} | ||
|
||
tools: | ||
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,11 +24,14 @@ const ( | |
flagCategoryNetwork = "Network Specific Configuration:" | ||
) | ||
|
||
// RawVersion and build tag of the Nebula command line tool. | ||
var RawVersion = "dev" | ||
var ( | ||
version = "dev" | ||
commit = "none" | ||
date = "unknown" | ||
builtBy = "local" | ||
) | ||
|
||
var rootConfig = &config.Root{ | ||
RawVersion: RawVersion, | ||
Debug: false, | ||
LogLevel: 4, | ||
LogFormat: "text", | ||
|
@@ -52,6 +55,10 @@ var rootConfig = &config.Root{ | |
ProtocolsCacheSize: 100, | ||
ProtocolsSetCacheSize: 200, | ||
}, | ||
RawVersion: version, | ||
BuildCommit: commit, | ||
BuildDate: date, | ||
BuiltBy: builtBy, | ||
} | ||
|
||
func main() { | ||
|
@@ -65,7 +72,7 @@ func main() { | |
Email: "[email protected]", | ||
}, | ||
}, | ||
Version: rootConfig.Version(), | ||
Version: fmt.Sprintf("v%s (%s)", rootConfig.Version(), rootConfig.BuildAuthor()), | ||
Before: Before, | ||
Flags: []cli.Flag{ | ||
&cli.BoolFlag{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters