Skip to content

Build container image #1050

Build container image

Build container image #1050

---
name: Build container image
"on":
workflow_dispatch:
schedule:
- cron: "0 3 * * *"
push:
paths:
- .github/workflows/build-container-image.yml
- Containerfile
- files/**
- scripts/*
branches:
- main
pull_request:
paths:
- .github/workflows/build-container-image.yml
- Containerfile
- files/**
- scripts/*
jobs:
build-container-image:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build container image
run: scripts/build.sh
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
VERSION: ${{ matrix.version }}
REPOSITORY: osism/inventory-reconciler
- name: Get short revision ID
id: revision
shell: bash
run: echo "::set-output name=short::$(git rev-parse --short HEAD)"
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
artifact-name: inventory-reconciler-${{ matrix.version }}.spdx
image: "inventory-reconciler:${{ steps.revision.outputs.short }}"
- name: Push container image
run: |
scripts/push.sh
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
VERSION: ${{ matrix.version }}
REPOSITORY: osism/inventory-reconciler
if: |
github.repository == 'osism/container-image-inventory-reconciler' &&
github.ref == 'refs/heads/main'