forked from RocksLabs/kvrocks_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
14 changed files
with
236 additions
and
118 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
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: goreleaser | ||
|
||
on: | ||
pull_request: | ||
push: | ||
# run only against tags | ||
tags: | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
|
||
- name: Run GoReleaser for build | ||
uses: goreleaser/goreleaser-action@v6 | ||
if: success() && !startsWith(github.ref, 'refs/tags/') | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro' | ||
distribution: goreleaser | ||
# 'latest', 'nightly', or a semver | ||
version: "~> v2" | ||
args: release --snapshot --clean -f ./.github/goreleaser.yml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub if publishing tag | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro' | ||
distribution: goreleaser | ||
# 'latest', 'nightly', or a semver | ||
version: "~> v2" | ||
args: release --clean -f ./.github/goreleaser.yml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v4 | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: kvrocks/kvrocks-exporter | ||
short-description: ${{ github.event.repository.description }} | ||
|
||
- name: Upload build results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: kvrocks_exporter_artifacts_${{ github.run_number }} | ||
path: dist/ |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,3 +14,5 @@ contrib/tls/ca.key | |
contrib/tls/ca.txt | ||
contrib/tls/redis.crt | ||
contrib/tls/redis.key | ||
|
||
dist/ |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -63,20 +63,12 @@ upload-coverage: | |
go install github.com/mattn/[email protected] | ||
/go/bin/goveralls -coverprofile=coverage.txt -service=drone.io | ||
|
||
.PHONY: build | ||
build: | ||
go build . | ||
|
||
.PHONY: release | ||
release: | ||
go install github.com/goreleaser/goreleaser/v2@latest | ||
|
||
BUILD_DT:=$(shell date +%F-%T) | ||
GO_LDFLAGS:="-s -w -extldflags \"-static\" -X main.BuildVersion=${DRONE_TAG} -X main.BuildCommitSha=${DRONE_COMMIT_SHA} -X main.BuildDate=$(BUILD_DT)" | ||
|
||
.PHONE: build-binaries | ||
build-binaries: | ||
go get github.com/oliver006/gox@master | ||
|
||
rm -rf .build | true | ||
|
||
export CGO_ENABLED=0 ; \ | ||
gox -os="linux windows freebsd netbsd openbsd" -arch="amd64 386" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${DRONE_TAG}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \ | ||
gox -os="darwin solaris illumos" -arch="amd64" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${DRONE_TAG}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \ | ||
gox -os="linux freebsd netbsd" -arch="arm" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${DRONE_TAG}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \ | ||
gox -os="linux" -arch="arm64 mips64 mips64le ppc64 ppc64le s390x" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${DRONE_TAG}.{{.OS}}-{{.Arch}}/{{.Dir}}" && \ | ||
echo "done" | ||
goreleaser release --clean -f .github/goreleaser.yml |
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
Oops, something went wrong.