Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
workflow_dispatch:
release:
types:
- published

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: "go.mod"
check-latest: true
cache: true

- name: Get build date
id: date
run: echo "date=$(date '+%F-%T')" >> "$GITHUB_OUTPUT"

- name: Get build unix timestamp
id: timestamp
run: echo "timestamp=$(date '+%s')" >> "$GITHUB_OUTPUT"

- name: Get git branch
id: branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"

- name: Get build platform
id: platform
run: echo "platform=$(go version | cut -d ' ' -f 4)" >> "$GITHUB_OUTPUT"

- name: Get Go version
id: go
run: echo "go=$(go version | cut -d ' ' -f 3)" >> "$GITHUB_OUTPUT"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
Comment thread
gregmankes marked this conversation as resolved.
with:
version: v2.12.7
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_DATE: ${{ steps.date.outputs.date }}
BUILD_TS_UNIX: ${{ steps.timestamp.outputs.timestamp }}
GIT_BRANCH: ${{ steps.branch.outputs.branch }}
BUILD_PLATFORM: ${{ steps.platform.outputs.platform }}
GO_VERSION: ${{ steps.go.outputs.go }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.dylib
/cloud-cli
/temporal-cloud
dist/

# Test binary, built with `go test -c`
*.test
Expand Down
71 changes: 71 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: 2

before:
hooks:
- go mod download

release:
prerelease: auto
draft: false
name_template: "v{{.Version}}"

archives:
- <<: &archive_defaults
name_template: "temporal_cloud_cli_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
id: nix
ids:
- nix
formats:
- tar.gz
files:
- LICENSE

- <<: *archive_defaults
id: windows-zip
ids:
- windows
formats:
- zip
files:
- LICENSE

# used by SDKs as zip cannot be used by rust https://github.com/zip-rs/zip/issues/108
- <<: *archive_defaults
id: windows-targz
ids:
- windows
files:
- LICENSE

builds:
- <<: &build_defaults
dir: cmd/temporal-cloud
binary: temporal-cloud
ldflags:
- -s -w -X github.com/temporalio/cloud-cli/temporalcloudcli.Version={{.Version}}
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
id: nix
goos:
- linux
- darwin

- <<: *build_defaults
id: windows
goos:
- windows
hooks:
post: # TODO sign Windows release

checksum:
name_template: "checksums.txt"
algorithm: sha256

changelog:
disable: true

announce:
skip: "true"
4 changes: 3 additions & 1 deletion temporalcloudcli/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ func (c *CloudCommand) GetAPIKey(ctx context.Context) (string, error) {
}

func newCloudClient(cctx *CommandContext) (*cloudclient.Client, error) {
opts := cloudclient.Options{}
opts := cloudclient.Options{
UserAgent: fmt.Sprintf("temporalio-cloud-cli/%s", VersionString()),
}
if cctx.RootCommand.Server != "" {
opts.HostPort = cctx.RootCommand.Server
}
Expand Down
6 changes: 2 additions & 4 deletions temporalcloudcli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/temporalio/cloud-cli/temporalcloudcli/internal/printer"
"github.com/temporalio/ui-server/v2/server/version"
"go.temporal.io/api/common/v1"
commonpb "go.temporal.io/api/common/v1"
"go.temporal.io/api/failure/v1"
"go.temporal.io/api/temporalproto"
"go.temporal.io/sdk/contrib/envconfig"
"go.temporal.io/sdk/converter"
"go.temporal.io/sdk/temporal"
"go.temporal.io/server/common/headers"
"golang.org/x/term"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -405,12 +403,12 @@ var buildInfo string

func VersionString() string {
// To add build-time information to the version string, use
// go build -ldflags "-X github.com/temporalio/cli/temporalcli.buildInfo=<MyString>"
// go build -ldflags "-X github.com/temporalio/cloud-cli/temporalcloudcli.buildInfo=<MyString>"
var bi = buildInfo
if bi != "" {
bi = fmt.Sprintf(", %s", bi)
}
return fmt.Sprintf("%s (Server %s, UI %s%s)", Version, headers.ServerVersion, version.UIVersion, bi)
return fmt.Sprintf("%s%s", Version, bi)
}

func (c *CloudCommand) preRun(cctx *CommandContext) error {
Expand Down