Skip to content
Merged
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
69 changes: 69 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"

- name: Log in to GHCR
run: podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }}

- name: Build bink binary
run: |
podman build --build-arg VERSION=${{ steps.version.outputs.version }} \
--target builder -t localhost/bink-builder:latest -f Containerfile .
podman create --name bink-builder-tmp localhost/bink-builder:latest
podman cp bink-builder-tmp:/output/bink ./bink
podman rm bink-builder-tmp
chmod +x ./bink
./bink version

- name: Build and push bink image
run: |
make build-bink-image VERSION=${{ steps.version.outputs.version }}
podman tag ${{ env.REGISTRY }}/${{ github.repository }}/bink:latest \
${{ env.REGISTRY }}/${{ github.repository }}/bink:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/bink:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/bink:latest

- name: Build and push cluster image
run: |
make build-cluster-image
podman tag ${{ env.REGISTRY }}/${{ github.repository }}/cluster:latest \
${{ env.REGISTRY }}/${{ github.repository }}/cluster:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/cluster:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/cluster:latest

- name: Build and push dns image
run: |
make build-dns-image
podman tag ${{ env.REGISTRY }}/${{ github.repository }}/dns:latest \
${{ env.REGISTRY }}/${{ github.repository }}/dns:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/dns:${{ steps.version.outputs.version }}
podman push ${{ env.REGISTRY }}/${{ github.repository }}/dns:latest

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.version.outputs.version }} \
./bink \
--title "${{ steps.version.outputs.version }}" \
--generate-notes
8 changes: 7 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ RUN --mount=type=cache,target=/go/pkg/mod \
go mod download

# Copy source and build
ARG VERSION=dev
COPY . /src
WORKDIR /output
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
cd /src && CGO_ENABLED=1 go build -o /output/bink ./cmd/bink
GIT_COMMIT=$(cd /src && git rev-parse --short HEAD 2>/dev/null || echo "") && \
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) && \
VERSION_PKG=github.com/bootc-dev/bink/internal/version && \
cd /src && CGO_ENABLED=1 go build \
-ldflags "-X ${VERSION_PKG}.Version=${VERSION} -X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} -X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" \
-o /output/bink ./cmd/bink

# Runtime image with just the binary and required C runtime libraries
FROM quay.io/fedora/fedora-minimal:${FEDORA_VERSION}
Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ FEDORA_VERSION := $(call extract,FedoraVersion )
# Binary
BINK_BINARY := bink

# Version info (overridable, e.g. make build-bink VERSION=v0.1.0)
VERSION ?= dev
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
VERSION_PKG := github.com/bootc-dev/bink/internal/version
LDFLAGS := -X $(VERSION_PKG).Version=$(VERSION) \
-X $(VERSION_PKG).GitCommit=$(GIT_COMMIT) \
-X $(VERSION_PKG).BuildDate=$(BUILD_DATE)

# Directories
VM_DIR := containerfiles/cluster-image

Expand All @@ -20,14 +29,15 @@ all: build-bink
# Build the bink CLI binary
build-bink:
@echo "=== Building bink CLI binary ==="
go build -o $(BINK_BINARY) ./cmd/bink
go build -ldflags "$(LDFLAGS)" -o $(BINK_BINARY) ./cmd/bink
@echo "✅ bink binary built: $(BINK_BINARY)"


# Build the bink CLI container image
build-bink-image:
@echo "=== Building bink CLI container image ==="
podman build --build-arg FEDORA_VERSION=$(FEDORA_VERSION) --target builder -t localhost/bink-builder:latest -f Containerfile .
podman build --build-arg FEDORA_VERSION=$(FEDORA_VERSION) -t $(BINK_IMAGE) -f Containerfile .
podman build --build-arg FEDORA_VERSION=$(FEDORA_VERSION) --build-arg VERSION=$(VERSION) --target builder -t localhost/bink-builder:latest -f Containerfile .
podman build --build-arg FEDORA_VERSION=$(FEDORA_VERSION) --build-arg VERSION=$(VERSION) -t $(BINK_IMAGE) -f Containerfile .
@echo "✅ Bink CLI image built: $(BINK_IMAGE)"

# Build the cluster container image
Expand Down
8 changes: 8 additions & 0 deletions cmd/bink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/bootc-dev/bink/internal/cli/node"
"github.com/bootc-dev/bink/internal/cli/registry"
"github.com/bootc-dev/bink/internal/config"
"github.com/bootc-dev/bink/internal/version"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -65,6 +66,13 @@ func init() {
rootCmd.AddCommand(node.NewNodeCmd())
rootCmd.AddCommand(api.NewAPICmd())
rootCmd.AddCommand(registry.NewRegistryCmd())
rootCmd.AddCommand(&cobra.Command{
Use: "version",
Short: "Print the version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.Print())
},
})
}

func initConfig() {
Expand Down
23 changes: 23 additions & 0 deletions internal/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2026 The bink Authors
// SPDX-License-Identifier: Apache-2.0

package version

import "fmt"

var (
Version = "dev"
GitCommit = ""
BuildDate = ""
)

func Print() string {
s := fmt.Sprintf("bink version %s", Version)
if GitCommit != "" {
s += fmt.Sprintf("\n commit: %s", GitCommit)
}
if BuildDate != "" {
s += fmt.Sprintf("\n built: %s", BuildDate)
}
return s
}
Loading