-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#29944 SBOM generation encapsulate into an action.
- Loading branch information
Showing
1 changed file
with
22 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,26 @@ inputs: | |
dotcms_version: | ||
description: 'The dotCMS version (vYY.MM.DD)' | ||
required: true | ||
dotcms_package: | ||
description: 'The dotCMS product (core, cli, etc.)' | ||
required: true | ||
github_token: | ||
description: 'GitHub token for pushing changes' | ||
required: true | ||
outputs: | ||
sbom-artifact: | ||
description: 'SBOM artifact' | ||
value: ${{ steps.sbom-artifact.outputs.artifact }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout core-test-results repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: dotCMS/core-test-results | ||
repository: dotCMS/core | ||
token: ${{ inputs.github_token }} | ||
path: core-test-results | ||
path: core | ||
|
||
- name: Set dotCMS version | ||
shell: bash | ||
|
@@ -37,26 +44,24 @@ runs: | |
- name: Scan Docker Image with Syft | ||
shell: bash | ||
run: | | ||
pipx run anchore_syft dotcms/dotcms:${{ env.DOTCMS_VERSION }} -o cyclonedx-xml > core-test-results/sbom/cyclonedx.json | ||
pipx run anchore_syft dotcms/dotcms:${{ env.DOTCMS_VERSION }} -o cyclonedx-json > core/sbom-cyclonedx.json | ||
- name: Rename SBOM file with dotCMS version | ||
shell: bash | ||
run: | | ||
mkdir -p core-test-results/sbom | ||
mv core-test-results/sbom/cyclonedx.json core-test-results/sbom/dotcms-${{ env.DOTCMS_VERSION }}.json | ||
mv core/sbom-cyclonedx.json core/sbom-dotcms-${{ inputs.dotcms_package }}-${{ env.DOTCMS_VERSION }}.json | ||
- name: Configure Git | ||
shell: bash | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
- name: Upload SBOM to GitHub | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sbom-dotcms-${{ inputs.dotcms_package }}-${{ env.DOTCMS_VERSION }} | ||
path: core/sbom-dotcms-${{ inputs.dotcms_package }}-${{ env.DOTCMS_VERSION }}.json | ||
|
||
- name: Commit and push results to core-test-results repository | ||
- name: Set SBOM artifact | ||
shell: bash | ||
run: | | ||
cd core-test-results | ||
git add sbom/dotcms-${{ env.DOTCMS_VERSION }}.json | ||
git commit -m "Add SBOM for dotCMS version ${{ env.DOTCMS_VERSION }}" || echo "No changes to commit" | ||
git push origin main | ||
id: sbom-artifact | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.github_token }} | ||
PACKAGE: ${{ inputs.dotcms_package }} | ||
VERSION: ${{ env.DOTCMS_VERSION }} | ||
run: | | ||
echo "artifact=sbom-dotcms-${PACKAGE}-${VERSION}" >> $GITHUB_OUTPUT |