Skip to content

Merge pull request #200 from sunya-ch/v1.2.4-rebase #82

Merge pull request #200 from sunya-ch/v1.2.4-rebase

Merge pull request #200 from sunya-ch/v1.2.4-rebase #82

name: Build and push controller and its bundle image
on:
push:
branches:
- v1.2.4
paths:
- controllers/**
- compute/**
- plugin/**
- ./main.go
- ./go.mod
- config/**
- ./Dockerfile
- ./bundle.Dockerfile
- ./Makefile
env:
VERSION: '1.2.4'
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
DAEMON_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build-push-bundle:
runs-on: ubuntu-latest
needs: build-push-controller
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}-bundle
CHANNELS: beta
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17.0'
- name: set ARCH and OD
run: |
echo "ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)" >> $GITHUB_ENV
echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.23.0" >> $GITHUB_ENV
- name: download operator-sdk
run: curl -LO ${{ env.OPERATOR_SDK_DL_URL }}/operator-sdk_${{ env.OS }}_${{ env.ARCH }}
- name: move operator-sdk to binary path
run: chmod +x operator-sdk_${{ env.OS }}_${{ env.ARCH }} && sudo mv operator-sdk_${{ env.OS }}_${{ env.ARCH }} /usr/local/bin/operator-sdk
- name: Tidy
run: |
go mod tidy
- name: Make bundle
run: make bundle
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Build and push bundle
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:v${{ env.VERSION }}
file: ./bundle.Dockerfile
build-push-controller:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}-controller
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17.0'
- name: Tidy
run: |
go mod tidy
make generate fmt vet
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Build and push controller
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ github.sha }}-${{ github.run_number }}
${{ env.IMAGE_NAME }}:v${{ env.VERSION }}
file: ./Dockerfile