diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 762ba5f6..cd350dbe 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -48,19 +48,19 @@ jobs: # Build and push Docker image - name: Build and push Docker image - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: context: . push: true - # Tags the image as 'latest' only for master branch, versioned tags for versioned pushes, and PR-specific tags + # Tags the image based on branch, PR, or release tags: | # Version tags for releases ${{ steps.meta.outputs.tags }} # Latest tag for master branch only - ${{ github.ref == 'refs/heads/master' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - - # Commit SHA for PR builds for more precise versioning - ${{ github.event_name == 'pull_request' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} + ${{ github.ref == 'refs/heads/master' && env.REGISTRY && env.IMAGE_NAME && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) }} - labels: ${{ steps.meta.outputs.labels }} + # Commit SHA for PR builds for precise versioning + ${{ github.event_name == 'pull_request' && env.REGISTRY && env.IMAGE_NAME && format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, github.sha) }} + + labels: ${{ steps.meta.outputs.labels }} diff --git a/Makefile b/Makefile index 910ce1c7..f0d3a2a6 100644 --- a/Makefile +++ b/Makefile @@ -33,13 +33,8 @@ SRC := $(shell find . -type f -name '*.go') GO_FILES ?= $$(find . -name '*.go') GO_PKGS ?= $$(go list ./...) -CONTROLLER_GEN_BINARY := bin/controller-gen -CLIENT_GEN_BINARY := bin/client-gen -DOCS_GEN_BINARY := bin/docs-gen -DEEPCOPY_GEN_BINARY := bin/deepcopy-gen -INFORMER_GEN_BINARY := bin/informer-gen -LISTER_GEN_BINARY := bin/lister-gen STATICCHECK_BINARY := bin/staticcheck +DOCS_GEN_BINARY := bin/docs-gen EMBEDMD_BINARY := bin/embedmd KIND_BINARY := $(shell pwd)/bin/kind KUBECTL_BINARY := $(shell pwd)/bin/kubectl @@ -120,31 +115,6 @@ goreleaser: ldflags: @echo $(LDFLAGS) -build-%: - @$(MAKE) --no-print-directory OS=$(word 1,$(subst -, ,$*)) ARCH=$(word 2,$(subst -, ,$*)) build - -container-latest-%: - @$(MAKE) --no-print-directory ARCH=$* container-latest - -container-%: - @$(MAKE) --no-print-directory ARCH=$* container - -push-latest-%: - @$(MAKE) --no-print-directory ARCH=$* push-latest - -push-%: - @$(MAKE) --no-print-directory ARCH=$* push - -all-build: $(addprefix build-$(OS)-, $(ALL_ARCH)) - -all-container: $(addprefix container-, $(ALL_ARCH)) - -all-push: $(addprefix push-, $(ALL_ARCH)) - -all-container-latest: $(addprefix container-latest-, $(ALL_ARCH)) - -all-push-latest: $(addprefix push-latest-, $(ALL_ARCH)) - generate: codegen crds fmt: @@ -224,33 +194,15 @@ website/build/index.html: website/docs/README.md docs/api.md container: docker build -t $(FULLY_QUALIFIED_IMAGE):latest -f Dockerfile . -clean: container-clean bin-clean +clean: bin-clean rm -rf .cache -container-clean: - rm -rf .container-* .manifest-* .push-* - bin-clean: rm -rf bin gomodtidy: go mod tidy -$(CONTROLLER_GEN_BINARY): - go build -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen - -$(CLIENT_GEN_BINARY): - go build -o $@ k8s.io/code-generator/cmd/client-gen - -$(DEEPCOPY_GEN_BINARY): - go build -o $@ k8s.io/code-generator/cmd/deepcopy-gen - -$(INFORMER_GEN_BINARY): - go build -o $@ k8s.io/code-generator/cmd/informer-gen - -$(LISTER_GEN_BINARY): - go build -o $@ k8s.io/code-generator/cmd/lister-gen - $(DOCS_GEN_BINARY): cmd/docs-gen/main.go go build -o $@ ./cmd/docs-gen