Created
July 28, 2022 21:15
-
-
Save jdolitsky/614a5696cf7c38b97aab1ab9c4667e79 to your computer and use it in GitHub Desktop.
Melange config file for bom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package: | |
name: bom | |
version: "{{ .Version }}" | |
description: A utility to generate SPDX-compliant Bill of Materials manifests | |
target-architecture: | |
- all | |
copyright: | |
- license: Apache-2.0 | |
paths: | |
- "*" | |
environment: | |
contents: | |
repositories: | |
- https://dl-cdn.alpinelinux.org/alpine/edge/main | |
- https://dl-cdn.alpinelinux.org/alpine/edge/community | |
packages: | |
- alpine-baselayout-data | |
- ca-certificates-bundle | |
- busybox | |
- bash | |
- git | |
- go | |
pipeline: | |
- uses: git-checkout | |
with: | |
repository: https://github.com/kubernetes-sigs/bom | |
branch: "v{{ .Version }}" | |
- name: Build bom from source | |
runs: | | |
set -x | |
BOM_NS="sigs.k8s.io/bom/pkg/version" | |
BOM_LD_FLAGS="-X ${BOM_NS}.GitVersion=$(git describe --tags --match=v*)" | |
BOM_LD_FLAGS="${BOM_LD_FLAGS} -X ${BOM_NS}.gitCommit=$(git rev-parse --short HEAD)" | |
BOM_LD_FLAGS="${BOM_LD_FLAGS} -X ${BOM_NS}.gitTreeState=clean" | |
BOM_LD_FLAGS="${BOM_LD_FLAGS} -X ${BOM_NS}.buildDate=$(date -u -d @$(git log -1 --pretty=%ct) +%Y-%m-%dT%H:%M:%SZ)" | |
CGO_ENABLED=0 go build \ | |
-v --ldflags="-w ${BOM_LD_FLAGS}" \ | |
-o "${{targets.destdir}}/usr/local/bin/bom" \ | |
cmd/bom/main.go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment