Skip to content

Commit 2d780ac

Browse files
Create bundle_2.0_schemas.yml
Signed-off-by: Steve Springett <[email protected]>
1 parent 4647138 commit 2d780ac

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Bundle CycloneDX 2.0 JSON Schemas
2+
3+
on:
4+
push:
5+
branches:
6+
- 2.0-dev
7+
- 2.0-dev-threatmodeling
8+
paths:
9+
- 'schema/2.0/**/*.schema.json'
10+
- 'tools/src/main/js/bundle-schemas.js'
11+
workflow_dispatch: # Allows manual trigger
12+
13+
jobs:
14+
bundle-schemas:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: write # Required to push changes
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
31+
- name: Install dependencies
32+
working-directory: tools/src/main/js
33+
run: npm install
34+
35+
- name: Bundle schemas
36+
working-directory: tools/src/main/js
37+
run: |
38+
node bundle-schemas.js \
39+
../../../../schema/2.0/model \
40+
../../../../schema/2.0/cyclonedx-2.0.schema.json
41+
42+
- name: Check for changes
43+
id: git-check
44+
run: |
45+
git diff --exit-code schema/2.0/cyclonedx-2.0-bundled.schema.json || echo "changed=true" >> $GITHUB_OUTPUT
46+
47+
- name: Commit and push changes
48+
if: steps.git-check.outputs.changed == 'true'
49+
run: |
50+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
51+
git config --local user.name "github-actions[bot]"
52+
git add schema/2.0/cyclonedx-2.0-bundled.schema.json
53+
git commit -m "chore: update bundled schema [skip ci]"
54+
git push

0 commit comments

Comments
 (0)