Pre-release v0.17.1 #50
Workflow file for this run
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
name: Release Go Binaries | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
releases-matrix: | |
name: Release Matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [darwin, linux, windows] | |
# NOTE: Intentionally, support legacy architectures for windows and darwin (MacOS) | |
goarch: [arm64, amd64, ppc64, s390x] | |
exclude: | |
# NOTE: PowerPC and System 390 only support Linux | |
- goos: darwin | |
goarch: ppc64 | |
- goos: darwin | |
goarch: s390x | |
- goos: windows | |
goarch: ppc64 | |
- goos: windows | |
goarch: s390x | |
steps: | |
- uses: actions/checkout@v4 | |
# Set build/link environment variables | |
- name: Set APP_NAME env | |
# GITHUB_REPOSITORY=CycloneDX/sbom-utility | |
run: echo APP_NAME=$(echo ${GITHUB_REPOSITORY} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV} | |
- name: Set APP_VERSION env | |
run: echo "APP_VERSION=${GITHUB_REF_NAME}" >> ${GITHUB_ENV} | |
- name: Set BUILD_TIME env | |
run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV} | |
- name: Set SBOM_NAME env | |
run: echo "SBOM_NAME=${{env.APP_NAME}}-${{env.APP_VERSION}}.bom.json" >> ${GITHUB_ENV} | |
- name: List of the GitHub Actions environment variables on Windows | |
run: env | sort | |
# Generate an SBOM | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Install SBOM generator (latest) | |
run: go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest | |
- name: Generate SBOM (from `go.mod`) | |
# run: cyclonedx-gomod mod -json=true "-output ${{env.APP_NAME}}-${{env.APP_VERSION}}.bom.json" . | |
run: cyclonedx-gomod mod -json=true -output ${{env.SBOM_NAME}} | |
# Release binaries in all GOOS/GOARCH combinations (with all config. files) | |
- uses: wangyoucao577/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.goarch }} | |
extra_files: LICENSE README.md config.json license.json custom.json ${{env.SBOM_NAME}} | |
# "auto" will use ZIP for Windows, otherwise default is TAR | |
compress_assets: auto | |
# NOTE: This verbose flag may be removed | |
build_flags: -v | |
ldflags: -X "main.Version=${{ env.APP_VERSION }}" -X "main.Binary=${{ env.APP_NAME }}" |