Skip to content

fix: fix binary missing error #4

fix: fix binary missing error

fix: fix binary missing error #4

Workflow file for this run

name: build
on:
push:
branches:
- master
- main
- v*
tags:
- v*
pull_request:
workflow_dispatch:
jobs:
build:
name: Build binaries
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.build_info.outputs.image_tag }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- id: build_info
name: Declare build info
run: |
image_tag=''
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
ref=${{ github.ref }}
if [[ "$ref" =~ 'refs/tags/' ]]; then
image_tag=${{ github.ref_name }}
elif [[ "$ref" =~ 'refs/heads/' ]]; then
image_tag="${branch}-head"
fi
echo "image_tag=${image_tag}" >>$GITHUB_OUTPUT
# Build binaries
- name: Run ci
run: make ci
- name: Upload binaries
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: binaries_artifact
path: ./bin/*
build_push_image:
name: Build and push image
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download binaries
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: binaries_artifact
path: ./bin/
- name: Add executable permission
run: chmod +x ./bin/*
- name: Login to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# For multi-platform support
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
# longhornio/kbench image
- name: Build and publish image
env:
REPO: docker.io/longhornio
TAG: ${{ needs.build.outputs.image_tag }}
TARGET_PLATFORMS: linux/amd64,linux/arm64
run: make workflow-image-build-push