File tree Expand file tree Collapse file tree 4 files changed +43
-5
lines changed Expand file tree Collapse file tree 4 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 6767
6868 - name : Build
6969 run : make build-image
70+
71+ build-push-image :
72+ name : Build and push image
73+ runs-on : ubuntu-latest
74+ if : ${{ github.ref == 'refs/heads/main' }}
75+ needs :
76+ - validate
77+ - codespell
78+ - build
79+ steps :
80+ - name : Checkout code
81+ uses : actions/checkout@v5
82+
83+ - uses : actions/setup-go@v6
84+ with :
85+ go-version : " ${{ env.GO_VERSION }}"
86+ cache : true
87+
88+ - name : Set up QEMU
89+ uses : docker/setup-qemu-action@v3
90+
91+ - name : Set up Docker Buildx
92+ uses : docker/setup-buildx-action@v3
93+
94+ - name : Log in to the Container registry
95+ uses : docker/login-action@v3
96+ with :
97+ registry : ${{ env.REGISTRY }}
98+ username : ${{ github.actor }}
99+ password : ${{ secrets.GITHUB_TOKEN }}
100+
101+ - name : Build and push image
102+ run : make build-image-push
103+ env :
104+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105+ IS_RELEASE : false
Original file line number Diff line number Diff line change 4141 password : ${{ secrets.GITHUB_TOKEN }}
4242
4343 - name : Build and push image
44- run : make image- build-push
44+ run : make build-image -push
4545 env :
4646 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4747
Original file line number Diff line number Diff line change 44 - REGISTRY={{ if index .Env "REGISTRY" }}{{ .Env.REGISTRY }}{{ else }}ghcr.io{{ end }}
55 - IMAGE_NAME={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else }}tinkerbell/cluster-api-provider-tinkerbell{{ end }}
66 - BINARY=capt
7+ - IS_RELEASE={{ if index .Env "IS_RELEASE" }}{{ .Env.IS_RELEASE }}{{ else }}true{{ end }}
78
89before :
910 hooks :
@@ -36,8 +37,9 @@ dockers_v2:
3637 - images :
3738 - " {{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}"
3839 tags :
39- - " v{{ .Version }}"
40- - " {{ if not .IsNightly }}latest{{ end }}"
40+ - ' {{ if eq .Env.IS_RELEASE "true" }}v{{ .Version }}{{ end }}'
41+ - ' {{ if not .IsNightly }}latest{{ end }}'
42+ - ' {{ if eq .Branch "main" }}sha-{{ .ShortCommit }}{{ end }}'
4143 labels :
4244 " org.opencontainers.image.created " : " {{.Date}}"
4345 " org.opencontainers.image.name " : " {{.ProjectName}}"
Original file line number Diff line number Diff line change @@ -142,8 +142,8 @@ build: generate $(GORELEASER) ## Build the CAPT binary
142142build-image : $(GORELEASER ) # # Build the container image
143143 ${GORELEASER} release --snapshot --clean --verbose
144144
145- .PHONY : image- build-push
146- image- build-push : $(GORELEASER ) # # Build and push the container image
145+ .PHONY : build-image -push
146+ build-image -push : $(GORELEASER ) # # Build and push the container image
147147 ${GORELEASER} release --clean --verbose
148148
149149# # --------------------------------------
You can’t perform that action at this time.
0 commit comments