Skip to content

Commit 91b6a19

Browse files
committed
Removing duplicate composer setup and aggregating actions in composite step
1 parent 426ec99 commit 91b6a19

File tree

3 files changed

+16
-59
lines changed

3 files changed

+16
-59
lines changed

.github/actions/sbom-update/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ inputs:
99
runs:
1010
using: composite
1111
steps:
12+
- name: Allow CycloneDX plugin
13+
shell: bash
14+
run: ./composer config allow-plugins.cyclonedx/cyclonedx-php-composer true
15+
- name: Install CycloneDX plugin
16+
shell: bash
17+
run: ./composer require --dev cyclonedx/cyclonedx-php-composer --ignore-platform-reqs
1218
- name: Generate SBOM
1319
shell: bash
1420
working-directory: ${{ inputs.working-directory }}
1521
run: |
1622
echo "Generating SBOM for 'php' project..."
17-
./composer CycloneDX:make-sbom --output-file=sbom.json --output-format=json --spec-version=1.5
18-
23+
./composer CycloneDX:make-sbom --output-file=${{ inputs.output-file }} --output-format=json --spec-version=1.5
1924
- name: Validate SBOM
2025
shell: bash
2126
run: |

.github/actions/setup-sbom/action.yml

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

.github/workflows/release-with-sbom.yml

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -58,55 +58,28 @@ jobs:
5858
#
5959
# Preliminary checks done - generate SBOM before tagging
6060
#
61-
62-
- name: "Setup PHP environment"
63-
id: setup-php
64-
uses: ./.github/actions/setup
65-
with:
66-
php-version: ${{ env.PHP_VERSION }}
67-
driver-version: ${{ env.DRIVER_VERSION }}
68-
working-directory: '.'
69-
continue-on-error: true
7061

7162
- name: Checkout repository (Base Branch)
7263
uses: actions/checkout@v4
7364
with:
7465
ref: ${{ github.event.pull_request.base.ref }}
7566
token: ${{ secrets.GITHUB_TOKEN }}
76-
fetch-depth: 1
77-
78-
- name: Setup PHP environment
67+
fetch-depth: 0
68+
- name: "Setup PHP environment"
69+
id: setup-php
7970
uses: ./.github/actions/setup
8071
with:
8172
php-version: ${{ env.PHP_VERSION }}
8273
driver-version: ${{ env.DRIVER_VERSION }}
8374
working-directory: '.'
84-
85-
- name: "Generate/Update composer.lock"
86-
id: composer-lock
87-
run: |
88-
echo "Resolving dependencies and generating composer.lock..."
89-
composer update --lock --no-install --ignore-platform-reqs
90-
echo "composer.lock generated with resolved versions"
91-
continue-on-error: true
92-
93-
- name: "Setup SBOM environment"
94-
id: setup-sbom
95-
if: steps.composer-lock.outcome == 'success'
96-
uses: ./.github/actions/setup-sbom
9775
continue-on-error: true
98-
99-
- name: "Generate SBOM"
76+
- name: "Generate SBOM with CycloneDX"
10077
id: generate-sbom
101-
if: steps.setup-sbom.outcome == 'success'
78+
if: steps.setup-php.outcome == 'success'
10279
uses: ./.github/actions/sbom-update
10380
with:
104-
php-version: ${{ env.PHP_VERSION }}
105-
working-directory: '.'
10681
output-file: ${{ env.SBOM_FILE }}
107-
output-format: 'json'
10882
continue-on-error: true
109-
11083
- name: "Check for SBOM changes"
11184
id: sbom_status
11285
if: steps.generate-sbom.outcome == 'success'
@@ -138,16 +111,17 @@ jobs:
138111
git add ${{ env.SBOM_FILE }}
139112
git commit -m "chore: Update SBOM for release ${{ inputs.version }}"
140113
git push
141-
echo "📦 SBOM updated and committed" >> $GITHUB_STEP_SUMMARY
114+
echo "SBOM updated and committed" >> $GITHUB_STEP_SUMMARY
142115
continue-on-error: true
143116

144117
- name: "Report SBOM status"
145118
run: |
146119
if [[ "${{ steps.generate-sbom.outcome }}" == "success" ]]; then
147-
echo "SBOM generation completed successfully" >> $GITHUB_STEP_SUMMARY
120+
echo "SBOM generation completed successfully" >> $GITHUB_STEP_SUMMARY
148121
else
149-
echo "⚠️ SBOM generation skipped or failed - continuing with release" >> $GITHUB_STEP_SUMMARY
122+
echo "SBOM generation skipped or failed - continuing with release" >> $GITHUB_STEP_SUMMARY
150123
fi
124+
151125
#
152126
# Preliminary checks done - commence the release process
153127
#

0 commit comments

Comments
 (0)