diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f7e93947..d063e5de 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -15,7 +15,7 @@ builds: # - windows - darwin ldflags: - - -X "main.version={{.Env.CLI_TAG}}" + - -X "main.version={{.Version}}" archives: - format: tar.gz @@ -29,23 +29,94 @@ archives: {{- if .Arm }}v{{ .Arm }}{{ end }} # use zip for windows archives format_overrides: - - goos: windows - format: zip + - goos: windows + format: zip checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: name_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" project_name: lekko # .goreleaser.yaml +blobs: + # You can have multiple blob configs + - # Cloud provider name: + # - s3 for AWS S3 Storage + # - azblob for Azure Blob Storage + # - gs for Google Cloud Storage + # + # Templates: allowed + provider: s3 + + # Set a custom endpoint, useful if you're using a minio backend or + # other s3-compatible backends. + # + # Implies s3ForcePathStyle and requires provider to be `s3` + # + # Templates: allowed + # endpoint: https://minio.foo.bar + + # Sets the bucket region. + # Requires provider to be `s3` + # + # Templates: allowed + region: us-east-1 + + # Disables SSL + # Requires provider to be `s3` + # disableSSL: true + + # Bucket name. + # + # Templates: allowed + bucket: "lekko-cli-releases" + + # IDs of the artifacts you want to upload. + # ids: + # - foo + # - bar + + # Path/name inside the bucket. + # + # Default: '{{ .ProjectName }}/{{ .Tag }}' + # Templates: allowed + folder: "{{.Version}}" + + # Whether to disable this particular upload configuration. + # + # Since: v1.17 + # Templates: allowed + # disable: '{{ neq .BLOB_UPLOAD_ONLY "foo" }}' + + # You can add extra pre-existing files to the bucket. + # The filename on the release will be the last part of the path (base). + # If another file with the same name exists, the last one found will be used. + # These globs can also include templates. + # extra_files: + # - glob: ./path/to/file.txt + # - glob: ./glob/**/to/**/file/**/* + # - glob: ./glob/foo/to/bar/file/foobar/override_from_previous + # - glob: ./single_file.txt + # # Templates: allowed + # name_template: file.txt # note that this only works if glob matches 1 file only + + # Additional templated extra files to uploaded. + # Those files will have their contents pass through the template engine, + # and its results will be uploaded. + # + # Since: v1.17 (pro) + # This feature is only available in GoReleaser Pro. + # Templates: allowed + # templated_extra_files: + # - src: LICENSE.tpl + # dst: LICENSE.txt brews: - - - # Name template of the recipe + - # Name template of the recipe # Default to project name # name: myproject @@ -72,7 +143,7 @@ brews: # done with scoop. # GitHub/GitLab repository to push the formula to - tap: + repository: # Repository owner template. (templateable) owner: lekkodev @@ -92,18 +163,18 @@ brews: # gitlab or gitea) # # Default depends on the client. - url_template: "https://github.com/lekkodev/cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}" + url_template: "https://lekko-cli-releases.s3.amazonaws.com/{{ .Tag }}/{{ .ArtifactName }}" # Allows you to set a custom download strategy. Note that you'll need # to implement the strategy and add it to your tap repository. # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly # Default is empty. - download_strategy: GitHubPrivateRepositoryReleaseDownloadStrategy + download_strategy: CurlDownloadStrategy # Allows you to add a custom require_relative at the top of the formula # template. # Default is empty - custom_require: ../lib/custom_download_strategy + # custom_require: ../lib/custom_download_strategy # Git author used to commit to the repository. # Defaults are shown. @@ -190,7 +261,6 @@ brews: # etc.install "app-config.conf" # ... - # The lines beneath this are called `modelines`. See `:help modeline` # Feel free to remove those if you don't want/use them. # yaml-language-server: $schema=https://goreleaser.com/static/schema.json diff --git a/README.md b/README.md index 69708bb7..5e9c0e4b 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,15 @@ CLI Interface to the Lekko Dynamic Configuration Platform. -## Documentation +## Documentation Find our documentation at https://app.lekko.com/docs. ## Download -To download `lekko` cli, you can use homebrew. Since the code is still in a private repository, you will need to use a Github personal access token that has been given access to `lekkodev/homebrew-lekko` and `lekkodev/cli` repos. +To download `lekko` cli, you can use homebrew. ```bash -export HOMEBREW_GITHUB_API_TOKEN= brew tap lekkodev/lekko brew install lekko ``` @@ -42,6 +41,8 @@ This command will first prompt you for a new tag that it will push to GitHub. Th After completion, navigate to https://github.com/lekkodev/cli/releases/ to see the latest releases under the tag you just created. +Because the CLI repository is still private, the releaser is configured to publish the compiled assets to a public S3 bucket (`lekko-cli-releases`). The releaser is also responsible for generating/updating the homebrew formula for the lekkodev/lekko brew [tap](https://github.com/lekkodev/homebrew-lekko), which will download and install the CLI from that bucket. + Done! The cli has just been released. Follow instructions above to [Download](#download) the latest cli. ## Integration Tests diff --git a/cmd/lekko/main.go b/cmd/lekko/main.go index f9ce0da0..9e974dc0 100644 --- a/cmd/lekko/main.go +++ b/cmd/lekko/main.go @@ -594,14 +594,9 @@ func upgradeCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { fmt.Printf( `Our CLI is currently managed by Homebrew. -In order to upgrade, first set your API key: - - export LEKKO_API_KEY=lekko_******** - -Next, run the following commands: +In order to upgrade, run the following commands: brew update - export HOMEBREW_GITHUB_API_TOKEN=$($(brew --repo)/Library/Taps/lekkodev/homebrew-lekko/gen_token.sh) brew upgrade lekko For more information, check out our docs: diff --git a/release.sh b/release.sh index cc6a0d56..6d57c8fd 100755 --- a/release.sh +++ b/release.sh @@ -2,7 +2,7 @@ # First, ensure that the github token is set if [[ -z $GITHUB_TOKEN ]]; then - echo Github token not found. + echo Github token not found. echo "Please set your github token via \"export GITHUB_TOKEN=\" and try again." exit 1 fi @@ -13,7 +13,7 @@ echo What would you like the new tag to be? read new_tag tag_message=`git --no-pager log -1 --pretty=%s` -echo Pushing $new_tag: $tag_message. +echo Pushing $new_tag: $tag_message. read -p "Continue? [y/N] " yn case $yn in [Yy]* ) echo Pushing to remote...;; @@ -31,5 +31,4 @@ case $yn in esac # Build & release, setting the tag as the lekko cli version via ldflags. -export CLI_TAG=$new_tag goreleaser release --clean