Skip to content

Commit cb224da

Browse files
authored
Merge pull request #83 from metal-stack/sbom
introduce standard docker workflow and include sbom in container images
2 parents 11cde37 + d98233f commit cb224da

File tree

3 files changed

+49
-67
lines changed

3 files changed

+49
-67
lines changed

.github/workflows/docker.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Image from master
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
release:
8+
types:
9+
- published
10+
push:
11+
branches:
12+
- master
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
- name: Fetch tags # fetch-tags does not work
25+
run: git fetch --prune --unshallow --tags
26+
27+
- name: Make tag
28+
run: |
29+
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "TAG_NAME=$(echo $GITHUB_REF | awk -F / '{print $3}')-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
30+
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
31+
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "TAG_NAME=latest" >> $GITHUB_ENV || true
32+
33+
- name: Docker Login
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ secrets.DOCKER_REGISTRY_USER }}
38+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Build and push image
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
push: true
48+
sbom: true
49+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}

.github/workflows/master.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)