Skip to content

Build

Build #52

Workflow file for this run

# SPDX-FileCopyrightText: 2018 vasu1124
#
# SPDX-License-Identifier: CC0-1.0
name: Build
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'release/*'
paths:
- '**.go'
- 'cmd/**'
- 'pkg/**'
- 'tmpl/**'
- 'css/**'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '!pkg/operator/useless/bin/**'
- '!pkg/operator/useless/config/**'
- '!pkg/operator/useless/hack/**'
- '!pkg/operator/useless/Dockerfile'
- '!pkg/operator/useless/Makefile'
jobs:
build:
name: Build and Push with Docker buildx
runs-on: ubuntu-latest
# env:
# multi-platform build is possible, disabled because no demos with arm currently
# linux/arm64
# DOCKER_TARGET_PLATFORM: linux/amd64,linux/arm/v7
steps:
- name: Check out cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
/tmp/.buildx-cache
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: 1.19
# id: go
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# with:
# platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
id: buildx
- name: Set up Helm
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: azure/setup-helm@v3
- name: Set up OCM
uses: vasu1124/ocm-setup-action@main
with:
version: 0.3.0-rc.1
- name: Check out code
uses: actions/checkout@v4
- run: |
cat .env >> $GITHUB_ENV
- name: Docker login to DockerHub
if: success()
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker login to GitHub Container Registry
if: success()
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Helm login to GitHub Container Registry
if: success()
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login --username ${{ github.repository_owner }} --password-stdin ghcr.io
- name: Docker Buildx (build+push)
if: success()
uses: docker/build-push-action@v5
with:
context: .
# platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
${{ env.ORG }}/introspect:${{ env.INTROSPECT_VERSION }}
${{ env.OCI }}/${{ env.ORG }}/introspect:${{ env.INTROSPECT_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
gitVersion=${{ env.INTROSPECT_VERSION }}
gitCommit=${{ github.sha }}
gitTreeState=clean
file: ./Dockerfile
- name: Inspect image
if: success()
run: |
docker buildx imagetools inspect ${{ env.OCI }}/${{ env.ORG }}/introspect:${{ env.INTROSPECT_VERSION }}
- name: create and publish OCM descriptors
run: |
make ctf-push