diff --git a/.github/changelog/generate-changelog.sh b/.github/changelog/generate-changelog.sh index a5274bb..6cdd708 100644 --- a/.github/changelog/generate-changelog.sh +++ b/.github/changelog/generate-changelog.sh @@ -10,7 +10,7 @@ __root="$(dirname "$__parent")" CHANGELOG_FILE_NAME="CHANGELOG.md" CHANGELOG_TMP_FILE_NAME="CHANGELOG.tmp" TARGET_SHA=$(git rev-parse HEAD) -PREVIOUS_RELEASE_TAG=$(git describe --abbrev=0 --match='v*.*.*' --tags) +PREVIOUS_RELEASE_TAG=$(git tag -l | sort -V | grep -E 'v[0-9]+.[0-9]+.[0-9]+$' | tail -n 1) PREVIOUS_RELEASE_SHA=$(git rev-list -n 1 $PREVIOUS_RELEASE_TAG) if [ $TARGET_SHA == $PREVIOUS_RELEASE_SHA ]; then diff --git a/.goreleaser-prerelease.yaml b/.goreleaser-prerelease.yaml deleted file mode 100644 index caa4f71..0000000 --- a/.goreleaser-prerelease.yaml +++ /dev/null @@ -1,129 +0,0 @@ -project_name: golink - -before: - hooks: - # You may remove this if you don't use go modules. - - go mod tidy - -snapshot: - name_template: "{{ .Tag }}" - -checksum: - name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt' - -builds: - - id: "golink" - binary: golink - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}' - goos: - - freebsd - - windows - - linux - - darwin - goarch: - - amd64 - - arm - - arm64 - env: - - CGO_ENABLED=0 - - id: "glctl" - binary: glctl - main: ./cmd/glctl - ldflags: - - '-s -w -X github.com/azrod/golink/cmd/glctl/cmd.version={{.Version}} -X github.com/azrod/golink/cmd/glctl/cmd.commit={{.Commit}} -X github.com/azrod/golink/cmd/glctl/cmd.date={{.Date}}' - goos: - - freebsd - - windows - - linux - - darwin - goarch: - - amd64 - - arm - - arm64 - env: - - CGO_ENABLED=0 - -dockers: - - goarch: amd64 - image_templates: - - "ghcr.io/azrod/{{.ProjectName}}:v{{ .Version }}-amd64" - extra_files: - - ui/ - dockerfile: Dockerfile - use: buildx - ids: - - golink - - glctl - build_flag_templates: - - --platform=linux/amd64 - - --pull - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/azrod/{{ .ProjectName }} - - --label=org.opencontainers.image.source=https://github.com/azrod/{{.ProjectName}} - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - - goarch: arm64 - image_templates: - - "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}-arm64v8" - extra_files: - - ui/ - dockerfile: Dockerfile - use: buildx - ids: - - golink - - glctl - build_flag_templates: - - --platform=linux/arm64/v8 - - --pull - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/azrod/{{ .ProjectName }} - - --label=org.opencontainers.image.source=https://github.com/azrod/{{ .ProjectName }} - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - -docker_manifests: -- name_template: "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}" - image_templates: - - "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}-amd64" - - "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}-arm64v8" -- name_template: "ghcr.io/azrod/{{ .ProjectName }}:latest" - image_templates: - - "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}-amd64" - - "ghcr.io/azrod/{{ .ProjectName }}:v{{ .Version }}-arm64v8" - -archives: - # Golink - - id: "golink" - builds: - - golink - format: tar.gz - wrap_in_directory: true - format_overrides: - - goos: windows - format: zip - name_template: 'golink-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - files: - - LICENSE - - README.md - # glctl - - id: "glctl" - builds: - - glctl - format: tar.gz - wrap_in_directory: true - format_overrides: - - goos: windows - format: zip - name_template: 'glctl-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - files: - - LICENSE - - ./cmd/glctl/README.md - -release: - prerelease: true \ No newline at end of file diff --git a/cmd/glctl/cmd/get-namespace.go b/cmd/glctl/cmd/get-namespace.go index c3ad897..438ba45 100644 --- a/cmd/glctl/cmd/get-namespace.go +++ b/cmd/glctl/cmd/get-namespace.go @@ -27,7 +27,7 @@ $> glctl get namespace [NAME] # Get a multiple namespaces $> glctl get namespace [NAME] [NAME] [NAME]`, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + ValidArgsFunction: func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { sdk := initSDK() nss, err := sdk.GetNamespaces(cmd.Context()) if err != nil { diff --git a/cmd/glctl/cmd/go.go b/cmd/glctl/cmd/go.go index 0fa5ee5..97ec952 100644 --- a/cmd/glctl/cmd/go.go +++ b/cmd/glctl/cmd/go.go @@ -23,7 +23,7 @@ $> glctl go [NAMESPACE/LINKNAME] Args: func(cmd *cobra.Command, args []string) error { return cobra.ExactArgs(1)(cmd, args) }, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + ValidArgsFunction: func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { sdk := initSDK() nss, err := sdk.GetNamespaces(cmd.Context()) if err != nil { diff --git a/cmd/glctl/cmd/update.go b/cmd/glctl/cmd/update.go index 681e013..6368dec 100644 --- a/cmd/glctl/cmd/update.go +++ b/cmd/glctl/cmd/update.go @@ -16,7 +16,7 @@ var updateCmd = &cobra.Command{ GroupID: "other", Short: "Check for updates and update the application", Long: `Check if a new version is available and update the application.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { if version == "dev" { log.Printf("Cannot update a development version") return diff --git a/cmd/glctl/cmd/version.go b/cmd/glctl/cmd/version.go index 9a49962..58ff8bb 100644 --- a/cmd/glctl/cmd/version.go +++ b/cmd/glctl/cmd/version.go @@ -11,7 +11,7 @@ var versionCmd = &cobra.Command{ GroupID: "other", Short: "Returns the version of the application", Long: `Returns the version, commit hash and build date of the application.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { sdk := initSDK() // Ignore errors, we don't care if the server is not reachable