Files
netbird-kubernetes-operator/.github/workflows/release.yaml
T
Philip LaineandGitHub 59e0ee8daa Refactor Dockerfile to build Go binary outside of Docker (#218)
This change moves building the Go binary out of the Dockerfile, and also
fixes some issues in the makefile. These things will speed up build
times and avoid rebuilding when not needed. Additionally it will make
getting version data easier to use as part of the user agent.

Signed-off-by: Philip Laine <philip.laine@gmail.com>
2026-05-04 14:44:10 +02:00

42 lines
1.2 KiB
YAML

name: release
on:
push:
tags:
- "v*"
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Clone the code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
with:
go-version-file: go.mod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd #v4.0.0
- name: Login to Docker Hub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 #v4.1.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build image
id: build
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
IMG_TAG="${GITHUB_REF_NAME#v}"
else
IMG_TAG="${GITHUB_SHA::7}"
fi
IMG=$(make build-image-multiarch) || exit 1
echo "IMG=${IMG}" >> $GITHUB_OUTPUT
- name: Push image
run: |
docker push ${{ steps.build.outputs.IMG }}