From 1401c7f6bc9e98fe20736e53c555765d569239e3 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 30 Apr 2023 10:32:39 -0400 Subject: [PATCH 1/5] add go releaser pro --- .github/workflows/release_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index af395ce6c..70ca71dba 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -41,13 +41,14 @@ jobs: git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target - uses: goreleaser/goreleaser-action@v4 with: - distribution: goreleaser + distribution: pro version: latest args: release --clean env: GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }} FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }} AUR_KEY: ${{ secrets.AUR_KEY }} + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - uses: actions/setup-python@v4 - run: pip install --upgrade cloudsmith-cli - name: Publish to CloudSmith From 55ca6938db0ede52f66fe8c091af0b530f4f478e Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 30 Apr 2023 11:08:58 -0400 Subject: [PATCH 2/5] update cli github action to only listen to infisical-cli/{version} tags --- .github/workflows/release_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 70ca71dba..82fac8f2a 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -4,7 +4,7 @@ on: push: # run only against tags tags: - - "v*" + - "infisical-cli/v*.*.*" permissions: contents: write From ec97e1a9301a880b4a2a142c6a23db1c948618ea Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 30 Apr 2023 11:09:29 -0400 Subject: [PATCH 3/5] add mono repo support for goreleaser --- .goreleaser.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index dfcacf59d..3ebb3fc3f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -11,6 +11,10 @@ before: - ./cli/scripts/completions.sh - ./cli/scripts/manpages.sh +monorepo: + tag_prefix: infisical-cli/ + dir: cli + builds: - id: darwin-build binary: infisical @@ -74,14 +78,7 @@ checksum: name_template: "checksums.txt" snapshot: - name_template: "{{ incpatch .Version }}-devel" - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" + name_template: "{{ .Version }}-devel" # publishers: # - name: fury.io From a6e670e93a19ed9d7a9bd04201e3d4f6c9b6c763 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 30 Apr 2023 11:22:28 -0400 Subject: [PATCH 4/5] update tag fetch method to filetr for cli tags only --- cli/packages/util/check-for-update.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cli/packages/util/check-for-update.go b/cli/packages/util/check-for-update.go index 2f283070c..0c73c28dc 100644 --- a/cli/packages/util/check-for-update.go +++ b/cli/packages/util/check-for-update.go @@ -4,12 +4,14 @@ import ( "encoding/json" "errors" "fmt" - log "github.com/sirupsen/logrus" "io" "net/http" "os" "os/exec" "runtime" + "strings" + + log "github.com/sirupsen/logrus" "github.com/fatih/color" ) @@ -73,7 +75,23 @@ func getLatestTag(repoOwner string, repoName string) (string, error) { return "", fmt.Errorf("failed to unmarshal github response: %w", err) } - return tags[0].Name[1:], nil + // Filter tags with prefix "infisical-cli/" + prefix := "infisical-cli/" + var validTags []string + for _, tag := range tags { + if strings.HasPrefix(tag.Name, prefix) { + validTags = append(validTags, tag.Name) + } + } + + if len(validTags) == 0 { + return "", errors.New("no tags for the CLI is found") + } + + // Extract the version from the first valid tag + version := strings.TrimPrefix(validTags[0], prefix) + + return version, nil } func GetUpdateInstructions() string { From 9f0313f50b2f21f70479a418185dd2db0f750967 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 30 Apr 2023 11:28:55 -0400 Subject: [PATCH 5/5] strip v from existing tags --- cli/packages/util/check-for-update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/packages/util/check-for-update.go b/cli/packages/util/check-for-update.go index 0c73c28dc..53eb6dfb7 100644 --- a/cli/packages/util/check-for-update.go +++ b/cli/packages/util/check-for-update.go @@ -76,7 +76,7 @@ func getLatestTag(repoOwner string, repoName string) (string, error) { } // Filter tags with prefix "infisical-cli/" - prefix := "infisical-cli/" + prefix := "infisical-cli/v" var validTags []string for _, tag := range tags { if strings.HasPrefix(tag.Name, prefix) {