Skip to content

Commit

Permalink
ci: Fixed extra checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kvanzuijlen committed Feb 12, 2024
1 parent 29f029f commit 30eccde
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
GORELEASER_CURRENT_TAG: ${{ steps.draft_release.outputs.tag_name }}
- name: Version test
id: version
run: echo "version=$(./version bump 0.1.0)" >> "$GITHUB_OUTPUT"
run: echo "output=$(./version bump 0.1.0)" >> "$GITHUB_OUTPUT"
- name: Failed
if: ${{ steps.version.outputs.output != "0.1.1" }}
run: |-
Expand All @@ -44,10 +44,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Build Docker image
run: VERSION=$(git rev-parse --short HEAD) make docker-build
run: VERSION=$(git rev-parse --short HEAD) make docker-build docker-build-x-platform
- name: Version test
id: version
run: echo "version=$(docker run ghcr.io/version-cli/version:latest bump 0.1.0)" >> "$GITHUB_OUTPUT"
run: |-
echo "output=$(docker run ghcr.io/version-cli/version:latest bump 0.1.0)" >> "$GITHUB_OUTPUT"
- name: Failed
if: ${{ steps.version.outputs.output != "0.1.1" }}
run: |-
Expand Down
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@ build: validate-go-version clean $(BINARY)
$(BINARY):
CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X github.com/version-cli/version/cmd.VERSION=${VERSION}" -o $@

DOCKER_BUILDX_PLATFORM ?= --platform linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7
DOCKER_BUILDX_ARGS_LIST ?= \

DOCKER_BUILDX_ARGS_LIST ?= \
CREATED=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
REVISION=$(shell git rev-parse --short HEAD) \
VERSION=${VERSION}
DOCKER_BUILDX_ARGS := $(addprefix --build-arg ,$(DOCKER_BUILDX_ARGS_LIST))
DOCKER_BUILDX_TAGS := -t $(REPOSITORY):latest -t $(REPOSITORY):${VERSION}
DOCKER_BUILDX := docker buildx build ${DOCKER_BUILDX_ARGS} ${DOCKER_BUILDX_PLATFORM} ${DOCKER_BUILDX_TAGS} .
DOCKER_BUILDX_PUSH := $(DOCKER_BUILDX) --push
DOCKER_BUILDX_ARGS := $(addprefix --build-arg ,$(DOCKER_BUILDX_ARGS_LIST))
DOCKER_BUILDX_TAGS := -t $(REPOSITORY):latest -t $(REPOSITORY):${VERSION}
DOCKER_BUILDX_CACHE := --cache-from=type=gha --cache-to=type=gha
DOCKER_BUILDX := docker buildx build ${DOCKER_BUILDX_ARGS} ${DOCKER_BUILDX_CACHE} ${DOCKER_BUILDX_TAGS} .
DOCKER_BUILDX_X_PLATFORM := ${DOCKER_BUILDX} --platform linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7
DOCKER_BUILDX_PUSH := $(DOCKER_BUILDX_X_PLATFORM) --push

.PHONY: docker-build
docker-build:
$(DOCKER_BUILDX)
$(DOCKER_BUILDX) --load

.PHONY: docker-build-x-platform
docker-build-x-platform:
$(DOCKER_BUILDX_X_PLATFORM)

.PHONY: docker-push
docker-push:
Expand Down

0 comments on commit 30eccde

Please sign in to comment.