Skip to content

feat: expose custom labels for control plane machines (#59) #6

feat: expose custom labels for control plane machines (#59)

feat: expose custom labels for control plane machines (#59) #6

Workflow file for this run

# workflow to release assets as part of the release
name: Upload Release Asset
on:
push:
tags:
- "v*"
env:
REGISTRY: ghcr.io/${{ github.repository }}
GO_VERSION: "1.20"
permissions:
packages: write
contents: write
jobs:
image:
name: Build and push ${{ matrix.target }} image
runs-on: ubuntu-latest
strategy:
matrix:
target: [bootstrap, controlplane]
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.target }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.target }}-
${{ runner.os }}-buildx-
- name: Docker ${{ matrix.target }} metadata
id: meta
uses: docker/metadata-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.REGISTRY }}/${{ matrix.target }}-controller
flavor: latest=false
tags: type=ref,event=tag
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Env
run: |
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Build and push ${{ matrix.target }} image
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args: |
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
package=./${{ matrix.target }}/main.go
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
release:
name: Release
runs-on: ubuntu-latest
needs:
- image
steps:
- uses: actions/checkout@v3
- name: Set release
run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- uses: actions/cache@v3
with:
path: hack/tools/bin
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-tools-bin-release-
${{ runner.os }}-tools-bin-
- name: Docker ${{ matrix.target }} metadata
id: meta
uses: docker/metadata-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
${{ env.REGISTRY }}/controlplane-controller
${{ env.REGISTRY }}/bootstrap-controller
flavor: latest=false
tags: type=ref,event=tag
- name: manifest
run: |
make release
- name: manifest
run: make release-notes
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: out/*
body_path: _releasenotes/${{ env.RELEASE_TAG }}.md
draft: true
prerelease: false