-
Notifications
You must be signed in to change notification settings - Fork 0
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
edb2f55
commit f995b6d
Showing
4 changed files
with
224 additions
and
0 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,32 @@ | ||
name: release for alert agent | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
name: manual release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
actions: read | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
check-latest: true | ||
go-version-file: go.mod | ||
|
||
- name: Setup release environment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: |- | ||
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env | ||
- name: Release publish | ||
run: make release |
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,117 @@ | ||
version: 2 | ||
before: | ||
hooks: | ||
- go mod download | ||
|
||
builds: | ||
- id: "observability-agent-darwin" | ||
main: ./ | ||
binary: observability-agent | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=o64-clang | ||
- CXX=o64-clang++ | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
flags: | ||
- -tags=cgo | ||
ldflags: | ||
- -X main.BuildVersion={{.Version}} | ||
- -X main.BuildCommit={{.Commit}} | ||
- -X main.BuildTime={{.Date}} | ||
- id: "observability-agent-darwin-arm64" | ||
main: ./ | ||
binary: observability-agent | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=oa64-clang | ||
- CXX=oa64-clang++ | ||
goos: | ||
- darwin | ||
goarch: | ||
- arm64 | ||
flags: | ||
- -tags=cgo | ||
ldflags: | ||
- -X main.BuildVersion={{.Version}} | ||
- -X main.BuildCommit={{.Commit}} | ||
- -X main.BuildTime={{.Date}} | ||
- id: "observability-agent-linux" | ||
main: ./ | ||
binary: observability-agent | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=gcc | ||
- CXX=g++ | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
flags: | ||
- -tags=cgo | ||
ldflags: | ||
- -X main.BuildVersion={{.Version}} | ||
- -X main.BuildCommit={{.Commit}} | ||
- -X main.BuildTime={{.Date}} | ||
- id: "observability-agent-linux-arm64" | ||
main: ./ | ||
binary: observability-agent | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=aarch64-linux-gnu-gcc | ||
- CXX=aarch64-linux-gnu-g++ | ||
goos: | ||
- linux | ||
goarch: | ||
- arm64 | ||
flags: | ||
- -tags=cgo | ||
ldflags: | ||
- -X main.BuildVersion={{.Version}} -X main.BuildCommit={{.Commit}} -X main.BuildTime={{.Date}} | ||
- id: "observability-agent-windows" | ||
main: ./ | ||
binary: observability-agent | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
flags: | ||
- -tags=cgo | ||
- -buildmode=exe | ||
ldflags: | ||
- -X main.BuildVersion={{.Version}} | ||
- -X main.BuildCommit={{.Commit}} | ||
- -X main.BuildTime={{.Date}} | ||
|
||
archives: | ||
- name_template: '{{ .ProjectName }}_{{- title .Os }}_{{ .Arch }}' | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
builds: | ||
- observability-agent-darwin | ||
- observability-agent-darwin-arm64 | ||
- observability-agent-windows | ||
- observability-agent-linux | ||
- observability-agent-linux-arm64 | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^chore:' | ||
- '^docs:' | ||
- '^test:' | ||
- '^ci:' | ||
|
||
snapshot: | ||
name_template: "{{ .Tag }}-next" |
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,68 @@ | ||
#!/usr/bin/make -f | ||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
COMMIT := $(shell git log -1 --format='%H') | ||
TIME ?= $(shell date +%Y-%m-%dT%H:%M:%S%z) | ||
|
||
# don't override user values | ||
ifeq (,$(VERSION)) | ||
VERSION := $(shell git describe --tags) | ||
# if VERSION is empty, then populate it with branch's name and raw commit hash | ||
ifeq (,$(VERSION)) | ||
VERSION := $(BRANCH)-$(COMMIT) | ||
endif | ||
endif | ||
|
||
ldflags = -X main.BuildVersion=$(VERSION) \ | ||
-X main.BuildCommit=$(COMMIT) \ | ||
-X main.BuildTime=$(TIME) | ||
|
||
BUILD_FLAGS := -ldflags '$(ldflags)' -tags=cgo | ||
|
||
# ---------------------------------------------------------------------------- # | ||
# Make targets # | ||
# ---------------------------------------------------------------------------- # | ||
.PHONY: install | ||
install: go.sum ## Installs the observability-agent binary | ||
go install -mod=readonly $(BUILD_FLAGS) . | ||
|
||
.PHONY: build | ||
build: ## Compiles the observability-agent binary | ||
go build -o build/observability-agent $(BUILD_FLAGS) . | ||
|
||
############################################################################### | ||
### Releasing ### | ||
############################################################################### | ||
|
||
PACKAGE_NAME:=github.com/dymensionxyz/observability-agent | ||
GOLANG_CROSS_VERSION = v1.23 | ||
GOPATH ?= '$(HOME)/go' | ||
|
||
release-dry-run: | ||
podman run \ | ||
--rm \ | ||
--privileged \ | ||
-e CGO_ENABLED=1 \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/$(PACKAGE_NAME) \ | ||
-v ${GOPATH}/pkg:/go/pkg \ | ||
-w /go/src/$(PACKAGE_NAME) \ | ||
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ | ||
--clean --skip=validate --skip=publish --snapshot | ||
|
||
release: | ||
@if [ ! -f ".release-env" ]; then \ | ||
echo "\033[91m.release-env is required for release\033[0m";\ | ||
exit 1;\ | ||
fi | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
-e CGO_ENABLED=1 \ | ||
--env-file .release-env \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/$(PACKAGE_NAME) \ | ||
-w /go/src/$(PACKAGE_NAME) \ | ||
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ | ||
release --clean --skip=validate | ||
|
||
.PHONY: release-dry-run release |
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