Skip to content
Open
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
18 changes: 4 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,12 @@ jobs:
go-version: "${{ env.GO_VERSION }}"
cache: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ko-build/setup-ko@v0.9
- run: ko login ${{ env.REGISTRY }} -u ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
run: make build-image-push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_RELEASE: false
GORELEASER_EXTRA_FLAGS: "--skip=validate"
IS_RELEASE: true
GORELEASER_EXTRA_FLAGS: "--clean --skip=validate"
18 changes: 6 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ jobs:
go-version: "${{ env.GO_VERSION }}"
cache: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ko-build/setup-ko@v0.9
env:
KO_DEFAULTBASEIMAGE: docker.io/chainguard/static
KO_DOCKER_REPO: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"

- run: ko login ${{ env.REGISTRY }} -u ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
run: make build-image-push
Expand Down
37 changes: 26 additions & 11 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2

env:
- REGISTRY={{ if index .Env "REGISTRY" }}{{ .Env.REGISTRY }}{{ else }}ghcr.io{{ end }}
- IMAGE_NAME={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else }}tinkerbell/cluster-api-provider-tinkerbell{{ end }}
- IMAGE_NAME={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else }}{{.GitURL | trimprefix "https://" | trimprefix "git@" | trimprefix "github.com" | trimprefix ":" | trimprefix "/" | trimsuffix ".git"}}{{ end }}
- BINARY=capt
- IS_RELEASE={{ if index .Env "IS_RELEASE" }}{{ .Env.IS_RELEASE }}{{ else }}true{{ end }}

Expand All @@ -14,35 +14,50 @@ builds:
- id: build
binary: "{{ .Env.BINARY }}"
env:
- CGO_ENABLED=0
- CGO_ENABLED=0
goos:
- linux
- linux
ldflags:
- -s -w
- -s -w
goarch:
- amd64
- arm64
- amd64
- arm64
skip: false

checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"

archives:
- formats:
- binary
- binary

release:
disable: true

dockers_v2:
- images:
snapshot:
version_template: "{{ incpatch .Version }}-next"

kos:
- build: build
repositories:
- "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}"
tags:
- '{{ if eq .Env.IS_RELEASE "true" }}v{{ .Version }}{{ end }}'
- '{{ if not .IsNightly }}latest{{ end }}'
- "{{ if not .IsSnapshot }}latest{{ end }}"
- '{{ if eq .Branch "main" }}sha-{{ .ShortCommit }}{{ end }}'
labels:
"org.opencontainers.image.created": "{{.Date}}"
"org.opencontainers.image.name": "{{.ProjectName}}"
"org.opencontainers.image.revision": "{{.FullCommit}}"
"org.opencontainers.image.version": "v{{.Version}}"
"org.opencontainers.image.source": "{{.GitURL}}"
bare: true
preserve_import_paths: false
platforms:
- linux/amd64
- linux/arm64
base_image: docker.io/chainguard/static
creation_time: "{{.CommitTimestamp}}"
ko_data_creation_time: "{{.CommitTimestamp}}"
sbom: none
disable: "{{ .IsSnapshot }}"