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
36 changes: 31 additions & 5 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ inputs:
tag:
description: 'Tag to upload artifacts to.'
required: true

outputs:
hashes:
description: sha256sum hashes of built artifacts
Expand All @@ -29,17 +30,42 @@ runs:
with:
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/386
- name: Login to Docker
shell: bash
run: echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin

- name: Set up goreleaser
shell: bash
run: |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin
CONTAINER_ID="$(
docker run --detach \
--volume "$PWD:$PWD" \
--entrypoint tail \
ghcr.io/goreleaser/goreleaser-cross:latest \
-f /dev/null
)"
docker exec --tty "$CONTAINER_ID" dpkg --add-architecture i386
docker exec --tty "$CONTAINER_ID" apt-get update
docker exec --tty "$CONTAINER_ID" apt-get install --no-install-recommends -y -q crossbuild-essential-i386
docker exec --tty "$CONTAINER_ID" git config --global --add safe.directory '*'
echo "CONTAINER_ID=$CONTAINER_ID" >> "$GITHUB_ENV"

- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }} --config .goreleaser.yaml
shell: bash
run: docker exec
--env GITHUB_TOKEN
--env HOMEBREW_DEPLOY_KEY
--workdir "$PWD"
--tty
"$CONTAINER_ID"
goreleaser release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }} --config .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ inputs.token }}
HOMEBREW_DEPLOY_KEY: ${{ inputs.homebrew-gh-secret }}
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: ldcli
path: dist/*
- name: Hash build artifacts for provenance
id: hash
shell: bash
Expand Down
62 changes: 45 additions & 17 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
version: 2

project_name: ldcli

env:
- GO111MODULE=on
- CGO_ENABLED=1
- DOCKER_CLI_EXPERIMENTAL=enabled

builds:
- id: ldcli
binary: ldcli
Expand All @@ -6,46 +15,66 @@ builds:
- linux
- windows
goarch:
- 386
- "386"
- amd64
- arm64
ldflags:
- -s
- -w
- -linkmode external
- -extldflags -static
- -X 'main.version={{.Version}}'
ignore:
- goos: darwin
goarch: "386"
env:
- TOOLCHAIN_BASE=
{{- if eq .Os "darwin" -}}
o
{{- if eq .Arch "arm64" -}}a{{- end -}}
64-clang
{{- else -}}
{{- if eq .Os "windows" -}}/llvm-mingw/bin/{{- end -}}
{{- if eq .Arch "386" -}}i686{{- end -}}
{{- if eq .Arch "arm64" -}}aarch64{{- end -}}
{{- if eq .Arch "amd64" -}}x86_64{{- end -}}
-
{{- if eq .Os "windows" -}}w64-mingw32{{- end -}}
{{- if eq .Os "linux" -}}linux-gnu{{- end -}}
{{- end -}}
- CC={{ .Env.TOOLCHAIN_BASE }}{{ if ne .Os "darwin" }}-gcc{{ end }}
- CXX={{ .Env.TOOLCHAIN_BASE }}{{ if eq .Os "darwin" }}++{{ else }}-g++{{ end }}

dockers:
# AMD64
- image_templates:
- "launchdarkly/ldcli:{{ .Version }}-amd64"
- "launchdarkly/ldcli:v{{ .Major }}-amd64"
- "launchdarkly/ldcli:latest-amd64"
- "launchdarkly/ldcli:{{ .Version }}-amd64"
- "launchdarkly/ldcli:v{{ .Major }}-amd64"
- "launchdarkly/ldcli:latest-amd64"
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--pull"
- "--platform=linux/amd64"

# ARM64v8
- image_templates:
- "launchdarkly/ldcli:{{ .Version }}-arm64v8"
- "launchdarkly/ldcli:v{{ .Major }}-arm64v8"
- "launchdarkly/ldcli:latest-arm64v8"
- "launchdarkly/ldcli:{{ .Version }}-arm64v8"
- "launchdarkly/ldcli:v{{ .Major }}-arm64v8"
- "launchdarkly/ldcli:latest-arm64v8"
goos: linux
goarch: arm64
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"
- "--pull"
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "launchdarkly/ldcli:{{ .Version}}"
skip_push: false
image_templates:
- "launchdarkly/ldcli:{{ .Version }}-amd64"
- "launchdarkly/ldcli:{{ .Version }}-arm64v8"
- "launchdarkly/ldcli:{{ .Version }}-amd64"
- "launchdarkly/ldcli:{{ .Version }}-arm64v8"

- name_template: "launchdarkly/ldcli:v{{ .Major }}"
skip_push: false
Expand All @@ -59,8 +88,7 @@ docker_manifests:
- "launchdarkly/ldcli:latest-amd64"
- "launchdarkly/ldcli:latest-arm64v8"
brews:
-
name: ldcli
- name: ldcli
description: "The official command line interface for managing LaunchDarkly feature flags."
homepage: "https://launchdarkly.com"
repository:
Expand Down