chore: for sbom upload only use .dev #166
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: Generate and ingest SBOM into sbom.eclipse.org | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
default: 'main' | |
required: true | |
env: | |
PYTHON_VERSION: '3.12' | |
POETRY_VERSION: '1.8.4' | |
permissions: | |
contents: read | |
jobs: | |
generate-sbom: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.version }} | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
with: | |
virtualenvs-in-project: true | |
version: ${{ env.POETRY_VERSION }} | |
plugins: poetry-dynamic-versioning | |
- name: Install cyclonedx-py | |
run: pipx install cyclonedx-bom | |
- name: "Set static version for cyclonedx tool" | |
shell: bash | |
run: | | |
poetry version $(poetry version -s | sed 's/.dev[0-9]*/.dev/') | |
- name: Generate sbom | |
run: cyclonedx-py poetry --with main,app -o otterdog-bom.json | |
- name: Upload sbom | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: otterdog-bom.json | |
path: otterdog-bom.json | |
upload-sbom: | |
if: github.repository == 'eclipse-csi/otterdog' | |
runs-on: ubuntu-latest | |
needs: [ 'generate-sbom' ] | |
steps: | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: otterdog-bom.json | |
- name: Extract version | |
id: version | |
run: | | |
VERSION="$(jq -r '.metadata.component.version' < otterdog-bom.json)" | |
echo "version=$(echo ${VERSION})" >> $GITHUB_OUTPUT | |
- uses: DependencyTrack/gh-upload-sbom@48feab3080ff9e8f51f4d21861d9fc914eb744f5 # v3.1.0 | |
with: | |
serverHostname: 'sbom.eclipse.org' | |
apiKey: ${{ secrets.DEPENDENCY_TRACK_API_KEY }} | |
projectName: 'otterdog' | |
projectVersion: ${{ steps.version.outputs.version }} | |
bomFilename: "otterdog-bom.json" | |
parentName: 'otterdog' | |
parentVersion: 'parent' | |
autoCreate: true |