-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from amands98/aman/revamp
[WIP] feat: revamp harbor cli
- Loading branch information
Showing
26 changed files
with
189 additions
and
78 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,26 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Setup go env | ||
uses: actions/setup-go@master | ||
with: | ||
go-version: "1.20" | ||
- name: goreleaser with tag | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
# Go workspace file | ||
go.work | ||
/bin | ||
|
||
# harbor compiled file | ||
harbor | ||
/harbor | ||
dist/ |
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,37 @@ | ||
project_name: harbor | ||
|
||
builds: | ||
- main: ./cmd/harbor | ||
binary: ./harbor | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -w -s -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit={{.FullCommit}} | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
ignore: | ||
- goos: windows | ||
goarch: arm | ||
- goos: windows | ||
goarch: arm64 | ||
archives: | ||
- format: tar.gz | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
release: | ||
draft: true | ||
prerelease: auto | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" |
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,3 @@ | ||
# Code of Conduct | ||
|
||
Harbor follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). |
Empty file.
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,35 @@ | ||
GITCOMMIT := $(shell git rev-parse --short=8 HEAD) | ||
PROJECT_PKG = github.com/goharbor/harbor-cli | ||
RELEASE_CHANNEL="edge" | ||
LDFLAGS = "-w -s -X $(PROJECT_PKG)/version.GitCommit=$(GITCOMMIT) -X $(PROJECT_PKG)/version.ReleaseChannel=$(RELEASE_CHANNEL)" | ||
ARCH := amd64 | ||
GO_EXE = go | ||
|
||
make: | ||
gofmt -l -s -w . | ||
go build -ldflags=${LDFLAGS} -o harbor cmd/harbor/main.go | ||
|
||
windows: | ||
go build -ldflags=${LDFLAGS} -o harbor.exe cmd/harbor/main.go | ||
|
||
.PHONY: build-win-amd64 | ||
build-win-amd64: ## build for windows amd64 | ||
CGO_ENABLED=0 GOARCH=$(ARCH) GOOS=windows $(GO_EXE) build -v --ldflags=$(LDFLAGS) \ | ||
-o bin/harbor-windows-$(ARCH).exe ./cmd/harbor/main.go | ||
.PHONY: build-linux-amd64 | ||
build-linux-amd64: ## build for linux amd64 | ||
CGO_ENABLED=0 GOARCH=$(ARCH) GOOS=linux $(GO_EXE) build -v --ldflags=$(LDFLAGS) \ | ||
-o bin/harbor-linux-$(ARCH) ./cmd/harbor/main.go | ||
|
||
.PHONY: build-darwin-amd64 | ||
build-darwin-amd64: ## build for darwin amd64 | ||
CGO_ENABLED=0 GOARCH=$(ARCH) GOOS=darwin $(GO_EXE) build -v --ldflags=$(LDFLAGS) \ | ||
-o bin/harbor-darwin-$(ARCH) ./cmd/harbor/main.go | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf bin | ||
|
||
.PHONY: lint | ||
lint: | ||
golangci-lint run --timeout 5m |
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,10 @@ | ||
package version | ||
|
||
var ( | ||
Version = "0.1.0" | ||
GitCommit = "" | ||
) | ||
|
||
func GetVersion() string { | ||
return Version | ||
} |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/goharbor/harbor-cli/cmd/harbor/root" | ||
) | ||
|
||
func main() { | ||
err := root.New().Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} |
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
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
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.