Skip to content

Commit

Permalink
chore: only tag latest Docker images on default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Feb 9, 2024
1 parent 9ea48b5 commit 0eb0c17
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ runs:
shell: bash
run: |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USERNAME --password-stdin
- name: Check if default branch
uses: launchdarkly/gh-actions/actions/default-branch@b954c1539a76dff335127ec5210d47ddfaa8e5a6
id: default-branch
with:
token: ${{ inputs.token }}
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
env:
GITHUB_TOKEN: ${{ inputs.token }}
DEFAULT_BRANCH: ${{ steps.default-branch.outputs.value }}

- name: Upload Release Artifacts
shell: bash
Expand Down
73 changes: 60 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ dockers:
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-i386"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"
- "launchdarkly/ld-relay:latest-i386"
use: buildx
goos: linux
goarch: '386'
Expand All @@ -77,11 +76,23 @@ dockers:
- "--pull"
- "--platform=linux/386"

# i386 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-i386"
use: buildx
goos: linux
goarch: '386'
dockerfile: Dockerfile.goreleaser
skip_push: {{ if .Env.DEFAULT_BRANCH eq .Major }}false{{ else }}true{{ end }}

build_flag_templates:
- "--pull"
- "--platform=linux/386"

# AMD64
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:latest-amd64"
use: buildx
goos: linux
goarch: amd64
Expand All @@ -91,11 +102,22 @@ dockers:
- "--pull"
- "--platform=linux/amd64"

# AMD64 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-amd64"
use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: {{ if .Env.DEFAULT_BRANCH eq .Major }}false{{ else }}true{{ end }}
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"

# ARMv7
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:latest-armv7"
use: buildx
goos: linux
goarch: arm
Expand All @@ -106,11 +128,23 @@ dockers:
- "--pull"
- "--platform=linux/arm/v7"

# ARMv7 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-armv7"
use: buildx
goos: linux
goarch: arm
goarm: 7
dockerfile: Dockerfile.goreleaser
skip_push: {{ if .Env.DEFAULT_BRANCH eq .Major }}false{{ else }}true{{ end }}
build_flag_templates:
- "--pull"
- "--platform=linux/arm/v7"

# ARM64v8
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:latest-arm64v8"
use: buildx
goos: linux
goarch: arm64
Expand All @@ -119,6 +153,19 @@ dockers:
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"

# ARM64v8 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-arm64v8"
use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile.goreleaser
skip_push: {{ if .Env.DEFAULT_BRANCH eq .Major }}false{{ else }}true{{ end }}
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"

docker_manifests:
- name_template: "launchdarkly/ld-relay:{{ .Version}}"
skip_push: false
Expand All @@ -131,15 +178,15 @@ docker_manifests:
- name_template: "launchdarkly/ld-relay:v{{ .Major }}"
skip_push: false
image_templates:
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"

- name_template: "launchdarkly/ld-relay:latest"
skip_push: false
skip_push: {{ if .Env.DEFAULT_BRANCH eq .Major }}false{{ else }}true{{ end }}
image_templates:
- "launchdarkly/ld-relay:latest-amd64"
- "launchdarkly/ld-relay:latest-armv7"
- "launchdarkly/ld-relay:latest-arm64v8"
- "launchdarkly/ld-relay:latest-i386"
- "launchdarkly/ld-relay:latest-amd64"
- "launchdarkly/ld-relay:latest-armv7"
- "launchdarkly/ld-relay:latest-arm64v8"
- "launchdarkly/ld-relay:latest-i386"

0 comments on commit 0eb0c17

Please sign in to comment.