Skip to content

chore: fix component-governance-detection pipeline (#159) #441

chore: fix component-governance-detection pipeline (#159)

chore: fix component-governance-detection pipeline (#159) #441

Workflow file for this run

# This Github Action will build and publish images to github registry automatically.
# The image version can be either `latest` from the main branch or a tag whenever a tag is created.
name: Building and Publishing to GitHub
on:
push:
branches:
- main
create:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_VERSION: latest
GO_VERSION: '1.18'
jobs:
export-registry:
runs-on: ubuntu-20.04
outputs:
registry: ${{ steps.export.outputs.registry }}
steps:
- id: export
run: |
# registry must be in lowercase
echo "::set-output name=registry::$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])"
publish-images:
needs: export-registry
env:
REGISTRY: ${{ needs.export-registry.outputs.registry }}
runs-on: ubuntu-20.04
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- name: Set image version for a new release
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push controller manager images to registry
run: |
make push
env:
REGISTRY: ${{ env.REGISTRY}}
TAG: ${{ env.IMAGE_VERSION }}