Compare commits
127 Commits
predicate@
...
predicate@
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55e972012f | ||
|
|
c2dd1df1ec | ||
|
|
87ab9bb01b | ||
|
|
24900ce153 | ||
|
|
484c81f0bd | ||
|
|
eec1ec9904 | ||
|
|
b06100ab07 | ||
|
|
ccb8edd7db | ||
|
|
9a005994da | ||
|
|
57a8b1e21b | ||
|
|
0d73e3f2be | ||
|
|
2548367d4f | ||
|
|
f4e8bae046 | ||
|
|
0486c4aa49 | ||
|
|
e9b2cefbdf | ||
|
|
45bb4038a3 | ||
|
|
bd218ad0db | ||
|
|
bb6e4f037b | ||
|
|
4d6ee9870b | ||
|
|
22e8414d9e | ||
|
|
9d8c9cae4a | ||
|
|
8253d9c026 | ||
|
|
c0e357efe3 | ||
|
|
bced3cb77f | ||
|
|
32cff21fdd | ||
|
|
33f07475db | ||
|
|
ca5b36b219 | ||
|
|
c9a714d97f | ||
|
|
7d7fafdda7 | ||
|
|
20d6de2969 | ||
|
|
da22b2f914 | ||
|
|
ee52af96f0 | ||
|
|
ca1bdd855b | ||
|
|
eb46c951aa | ||
|
|
961916f218 | ||
|
|
965ff037e1 | ||
|
|
115c3be05f | ||
|
|
d19588d87c | ||
|
|
f3a82307fe | ||
|
|
820c5ce485 | ||
|
|
b8e2bbc9cd | ||
|
|
0fedf7318f | ||
|
|
ae2702efaf | ||
|
|
cfcbc966ee | ||
|
|
cbfd0027ae | ||
|
|
7ab83002c8 | ||
|
|
e4d3fb6c73 | ||
|
|
34581d8068 | ||
|
|
1455967b1b | ||
|
|
1763edca48 | ||
|
|
07be22cf65 | ||
|
|
75bd09c86f | ||
|
|
828437ffc4 | ||
|
|
b0ec042eff | ||
|
|
635d710917 | ||
|
|
6fc7229e7e | ||
|
|
8d422c6606 | ||
|
|
79cd71eb23 | ||
|
|
ac09fe97a4 | ||
|
|
386c403ae8 | ||
|
|
21fa38ed7b | ||
|
|
0730e3bc2d | ||
|
|
c82b553566 | ||
|
|
99fb7ccb42 | ||
|
|
55c18addeb | ||
|
|
5026d36637 | ||
|
|
dc92b4c0be | ||
|
|
dd4b089aa5 | ||
|
|
fa5285f58e | ||
|
|
bd470e0ef8 | ||
|
|
0d076ca0ac | ||
|
|
79af85adb2 | ||
|
|
9e75edd833 | ||
|
|
f19ab44411 | ||
|
|
8507f05fe1 | ||
|
|
25b3c0884a | ||
|
|
b5fe8a6c40 | ||
|
|
47c91cee86 | ||
|
|
6d7733f629 | ||
|
|
adc5c62972 | ||
|
|
8541e845e0 | ||
|
|
bfc4aecb6d | ||
|
|
3d6693daad | ||
|
|
8a2267cfa7 | ||
|
|
9acafbf4c3 | ||
|
|
91d05efbc3 | ||
|
|
ab8de8941e | ||
|
|
c43b2b4d84 | ||
|
|
fe4a732a3e | ||
|
|
ba663bc478 | ||
|
|
49e7311f18 | ||
|
|
cb316d67b7 | ||
|
|
4696efab19 | ||
|
|
dcbe3081a3 | ||
|
|
aaa2d0a82e | ||
|
|
dc3e3b331e | ||
|
|
c29e4e9225 | ||
|
|
798ee587a2 | ||
|
|
7d87da1e33 | ||
|
|
e318c7dfea | ||
|
|
614575ea4f | ||
|
|
d00b213255 | ||
|
|
f975621746 | ||
|
|
5297f161fa | ||
|
|
10c27177cd | ||
|
|
c80e3ed30c | ||
|
|
c168f2354d | ||
|
|
5448b22ebd | ||
|
|
b125530ffd | ||
|
|
534423496e | ||
|
|
2f5f68fcc3 | ||
|
|
36d21cdc72 | ||
|
|
38c481ec87 | ||
|
|
d9763b28c9 | ||
|
|
1afe01eb23 | ||
|
|
a624c741b8 | ||
|
|
d4f0c27f8d | ||
|
|
ab147f15c3 | ||
|
|
41d694c98d | ||
|
|
0b5415aa25 | ||
|
|
817d650747 | ||
|
|
5d89d51206 | ||
|
|
f8e0f3ab00 | ||
|
|
e37c92d3ba | ||
|
|
d023f128e6 | ||
|
|
48e5743928 | ||
|
|
05284cc010 |
@@ -1,4 +0,0 @@
|
|||||||
lib/
|
|
||||||
dist/
|
|
||||||
node_modules/
|
|
||||||
coverage/
|
|
||||||
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@@ -9,6 +9,8 @@ updates:
|
|||||||
update-types:
|
update-types:
|
||||||
- minor
|
- minor
|
||||||
- patch
|
- patch
|
||||||
|
ignore:
|
||||||
|
- dependency-name: 'actions/attest-sbom'
|
||||||
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: /
|
directory: /
|
||||||
|
|||||||
83
.github/linters/.eslintrc.yml
vendored
83
.github/linters/.eslintrc.yml
vendored
@@ -1,83 +0,0 @@
|
|||||||
env:
|
|
||||||
node: true
|
|
||||||
es6: true
|
|
||||||
jest: true
|
|
||||||
|
|
||||||
globals:
|
|
||||||
Atomics: readonly
|
|
||||||
SharedArrayBuffer: readonly
|
|
||||||
|
|
||||||
ignorePatterns:
|
|
||||||
- '!.*'
|
|
||||||
- '**/node_modules/.*'
|
|
||||||
- '**/dist/.*'
|
|
||||||
- '**/coverage/.*'
|
|
||||||
- '*.json'
|
|
||||||
|
|
||||||
parser: '@typescript-eslint/parser'
|
|
||||||
|
|
||||||
parserOptions:
|
|
||||||
ecmaVersion: 2023
|
|
||||||
sourceType: module
|
|
||||||
project:
|
|
||||||
- './.github/linters/tsconfig.json'
|
|
||||||
- './tsconfig.json'
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- jest
|
|
||||||
- '@typescript-eslint'
|
|
||||||
|
|
||||||
extends:
|
|
||||||
- eslint:recommended
|
|
||||||
- plugin:@typescript-eslint/eslint-recommended
|
|
||||||
- plugin:@typescript-eslint/recommended
|
|
||||||
- plugin:github/recommended
|
|
||||||
- plugin:jest/recommended
|
|
||||||
|
|
||||||
rules:
|
|
||||||
{
|
|
||||||
'camelcase': 'off',
|
|
||||||
'eslint-comments/no-use': 'off',
|
|
||||||
'eslint-comments/no-unused-disable': 'off',
|
|
||||||
'i18n-text/no-en': 'off',
|
|
||||||
'import/no-namespace': 'off',
|
|
||||||
'no-console': 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
'semi': 'off',
|
|
||||||
'@typescript-eslint/array-type': 'error',
|
|
||||||
'@typescript-eslint/await-thenable': 'error',
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'error',
|
|
||||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
||||||
'@typescript-eslint/explicit-member-accessibility':
|
|
||||||
['error', { 'accessibility': 'no-public' }],
|
|
||||||
'@typescript-eslint/explicit-function-return-type':
|
|
||||||
['error', { 'allowExpressions': true }],
|
|
||||||
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
||||||
'@typescript-eslint/no-array-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-empty-interface': 'error',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'error',
|
|
||||||
'@typescript-eslint/no-extraneous-class': 'error',
|
|
||||||
'@typescript-eslint/no-for-in-array': 'error',
|
|
||||||
'@typescript-eslint/no-inferrable-types': 'error',
|
|
||||||
'@typescript-eslint/no-misused-new': 'error',
|
|
||||||
'@typescript-eslint/no-namespace': 'error',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
||||||
'@typescript-eslint/no-require-imports': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'error',
|
|
||||||
'@typescript-eslint/no-useless-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-var-requires': 'error',
|
|
||||||
'@typescript-eslint/prefer-for-of': 'warn',
|
|
||||||
'@typescript-eslint/prefer-function-type': 'warn',
|
|
||||||
'@typescript-eslint/prefer-includes': 'error',
|
|
||||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
||||||
'@typescript-eslint/promise-function-async': 'error',
|
|
||||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
||||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
||||||
'@typescript-eslint/semi': ['error', 'never'],
|
|
||||||
'@typescript-eslint/space-before-function-paren': 'off',
|
|
||||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
||||||
'@typescript-eslint/unbound-method': 'error'
|
|
||||||
}
|
|
||||||
10
.github/linters/.yaml-lint.yml
vendored
10
.github/linters/.yaml-lint.yml
vendored
@@ -1,10 +0,0 @@
|
|||||||
rules:
|
|
||||||
document-end: disable
|
|
||||||
document-start:
|
|
||||||
level: warning
|
|
||||||
present: false
|
|
||||||
line-length:
|
|
||||||
level: warning
|
|
||||||
max: 80
|
|
||||||
allow-non-breakable-words: true
|
|
||||||
allow-non-breakable-inline-mappings: true
|
|
||||||
9
.github/linters/tsconfig.json
vendored
9
.github/linters/tsconfig.json
vendored
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"noEmit": true
|
|
||||||
},
|
|
||||||
"include": ["../../__tests__/**/*", "../../src/**/*"],
|
|
||||||
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
|
|
||||||
}
|
|
||||||
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
@@ -28,11 +28,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
id: setup-node
|
id: setup-node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
cache: npm
|
cache: npm
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||||
name: Upload Artifact
|
name: Upload Artifact
|
||||||
id: upload
|
id: upload
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
|
|||||||
39
.github/workflows/ci.yml
vendored
39
.github/workflows/ci.yml
vendored
@@ -21,11 +21,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
id: setup-node
|
id: setup-node
|
||||||
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
cache: npm
|
cache: npm
|
||||||
@@ -46,17 +46,18 @@ jobs:
|
|||||||
id: npm-ci-test
|
id: npm-ci-test
|
||||||
run: npm run ci-test
|
run: npm run ci-test
|
||||||
|
|
||||||
test-attest-sbom-with-local-sbom-file:
|
test-attest-sbom:
|
||||||
name: Test attest-sbom action with local sbom file
|
name: Test attest-sbom action with local sbom file
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
attestations: write
|
||||||
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
- name: Run attest-sbom
|
- name: Run attest-sbom
|
||||||
id: attest-sbom
|
id: attest-sbom
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -69,31 +70,3 @@ jobs:
|
|||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Dump output
|
- name: Dump output
|
||||||
run: jq < ${{ steps.attest-sbom.outputs.bundle-path }}
|
run: jq < ${{ steps.attest-sbom.outputs.bundle-path }}
|
||||||
test-attest-sbom:
|
|
||||||
name: Test attest-sbom action
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
id: checkout
|
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
||||||
- name: Run attest-sbom with spdx format
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
subject-digest: 'sha256:7d070f6b64d9bcc530fe99cc21eaaa4b3c364e0b2d367d7735671fa202a03b32'
|
|
||||||
subject-name: 'subject'
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
sbom-format: 'spdx'
|
|
||||||
- name: Run attest-sbom with cyclonedx format
|
|
||||||
id: attest-sbom
|
|
||||||
uses: ./
|
|
||||||
env:
|
|
||||||
INPUT_PRIVATE-SIGNING: 'true'
|
|
||||||
with:
|
|
||||||
subject-digest: 'sha256:7d070f6b64d9bcc530fe99cc21eaaa4b3c364e0b2d367d7735671fa202a03b32'
|
|
||||||
subject-name: 'subject'
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
sbom-format: 'cyclonedx'
|
|
||||||
|
|||||||
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@@ -32,19 +32,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
id: initialize
|
id: initialize
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
source-root: src
|
source-root: src
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
id: autobuild
|
id: autobuild
|
||||||
uses: github/codeql-action/autobuild@v3
|
uses: github/codeql-action/autobuild@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
id: analyze
|
id: analyze
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@df559355d593797519d70b90fc8edd5db049e7a2 # v3.29.9
|
||||||
|
|||||||
49
.github/workflows/linter.yml
vendored
49
.github/workflows/linter.yml
vendored
@@ -1,49 +0,0 @@
|
|||||||
name: Lint Codebase
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint Codebase
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
id: checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
id: setup-node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: .node-version
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
id: install
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Lint Codebase
|
|
||||||
id: super-linter
|
|
||||||
uses: super-linter/super-linter/slim@v6
|
|
||||||
env:
|
|
||||||
DEFAULT_BRANCH: main
|
|
||||||
FILTER_REGEX_EXCLUDE: dist/**/*
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
TYPESCRIPT_DEFAULT_STYLE: prettier
|
|
||||||
VALIDATE_ALL_CODEBASE: true
|
|
||||||
VALIDATE_JAVASCRIPT_STANDARD: false
|
|
||||||
VALIDATE_JSCPD: false
|
|
||||||
@@ -1 +1 @@
|
|||||||
20.6.0
|
24.5.0
|
||||||
|
|||||||
189
README.md
189
README.md
@@ -5,9 +5,8 @@ the [@actions/attest][1] package.
|
|||||||
|
|
||||||
Attestations bind some subject (a named artifact along with its digest) to a a
|
Attestations bind some subject (a named artifact along with its digest) to a a
|
||||||
Software Bill of Materials (SBOM) using the [in-toto][2] format. The action
|
Software Bill of Materials (SBOM) using the [in-toto][2] format. The action
|
||||||
accepts SBOMs which have been generated by external tools or can generate one
|
accepts SBOMs which have been generated by external tools. Provided SBOMs must
|
||||||
automatically by invoking the [anchore/sbom-action][3]. Externally generated
|
be in either the [SPDX][4] or [CycloneDX][5] JSON-serialized format.
|
||||||
SBOMs must be in either the [SPDX][4] or [CycloneDX][5] JSON-serialized format.
|
|
||||||
|
|
||||||
A verifiable signature is generated for the attestation using a short-lived
|
A verifiable signature is generated for the attestation using a short-lived
|
||||||
[Sigstore][6]-issued signing certificate. If the repository initiating the
|
[Sigstore][6]-issued signing certificate. If the repository initiating the
|
||||||
@@ -19,9 +18,22 @@ Once the attestation has been created and signed, it will be uploaded to the GH
|
|||||||
attestations API and associated with the repository from which the workflow was
|
attestations API and associated with the repository from which the workflow was
|
||||||
initiated.
|
initiated.
|
||||||
|
|
||||||
Attestations can be verified using the `attestation` command in the [GitHub
|
Attestations can be verified using the [`attestation` command in the GitHub
|
||||||
CLI][7].
|
CLI][7].
|
||||||
|
|
||||||
|
See [Using artifact attestations to establish provenance for builds][11] for
|
||||||
|
more information on artifact attestations.
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Artifact attestations are available in public repositories for all
|
||||||
|
> current GitHub plans. They are not available on legacy plans, such as Bronze,
|
||||||
|
> Silver, or Gold. If you are on a GitHub Free, GitHub Pro, or GitHub Team plan,
|
||||||
|
> artifact attestations are only available for public repositories. To use
|
||||||
|
> artifact attestations in private or internal repositories, you must be on a
|
||||||
|
> GitHub Enterprise Cloud plan.
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Within the GitHub Actions workflow which builds some artifact you would like to
|
Within the GitHub Actions workflow which builds some artifact you would like to
|
||||||
@@ -32,65 +44,67 @@ attest:
|
|||||||
```yaml
|
```yaml
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: write # TODO: Update this
|
attestations: write
|
||||||
```
|
```
|
||||||
|
|
||||||
The `id-token` permission gives the action the ability to mint the OIDC token
|
The `id-token` permission gives the action the ability to mint the OIDC token
|
||||||
necessary to request a Sigstore signing certificate. The `contents`
|
necessary to request a Sigstore signing certificate. The `attestations`
|
||||||
permission is necessary to persist the attestation.
|
permission is necessary to persist the attestation.
|
||||||
|
|
||||||
1. Add the following to your workflow after your artifact has been built:
|
1. Add the following to your workflow after your artifact has been built and
|
||||||
|
your SBOM has been generated:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest-sbom@v1
|
- uses: actions/attest-sbom@v2
|
||||||
with:
|
with:
|
||||||
subject-path: '<PATH TO ARTIFACT>'
|
subject-path: '<PATH TO ARTIFACT>'
|
||||||
|
sbom-path: '<PATH TO SBOM>'
|
||||||
```
|
```
|
||||||
|
|
||||||
The `subject-path` parameter should identity the artifact for which you want
|
The `subject-path` parameter should identify the artifact for which you want
|
||||||
to generate an SBOM attestation. When no other inputs are specified, the
|
to generate an SBOM attestation. The `sbom-path` parameter should identify
|
||||||
action will automatically generate an SPDX SBOM by scanning the
|
the SBOM document to be associated with the subject.
|
||||||
`github.workspace` directory.
|
|
||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
|
|
||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest-sbom@v2
|
||||||
with:
|
with:
|
||||||
# Path to the artifact serving as the subject of the attestation. Must
|
# Path to the artifact serving as the subject of the attestation. Must
|
||||||
# specify exactly one of "subject-path" or "subject-digest".
|
# specify exactly one of "subject-path", "subject-digest", or
|
||||||
|
# "subject-checksums". May contain a glob pattern or list of paths
|
||||||
|
# (total subject count cannot exceed 1024).
|
||||||
subject-path:
|
subject-path:
|
||||||
|
|
||||||
# SHA256 digest of the subject for for the attestation. Must be in the form
|
# SHA256 digest of the subject for the attestation. Must be in the form
|
||||||
# "sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one
|
# "sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one
|
||||||
# of "subject-path" or "subject-digest".
|
# of "subject-path", "subject-digest", or "subject-checksums".
|
||||||
subject-digest:
|
subject-digest:
|
||||||
|
|
||||||
# Subject name as it should appear in the attestation. Required unless
|
# Subject name as it should appear in the attestation. Required when
|
||||||
# "subject-path" is specified, in which case it will be inferred from the
|
# identifying the subject with the "subject-digest" input.
|
||||||
# path.
|
|
||||||
subject-name:
|
subject-name:
|
||||||
|
|
||||||
# Path to the JSON-formatted SBOM file to attest. When specified, the
|
# Path to checksums file containing digest and name of subjects for
|
||||||
# "scan-path" and "sbom-format" inputs are ignored.
|
# attestation. Must specify exactly one of "subject-path", "subject-digest",
|
||||||
|
# or "subject-checksums".
|
||||||
|
subject-checksums:
|
||||||
|
|
||||||
|
# Path to the JSON-formatted SBOM file to attest. File size cannot exceed
|
||||||
|
# 16MB.
|
||||||
sbom-path:
|
sbom-path:
|
||||||
|
|
||||||
# Path on the filesystem to scan for SBOM generation. Ignored if "sbom-path"
|
|
||||||
# is specified. Defaults to ${{ github.workspace }}
|
|
||||||
scan-path:
|
|
||||||
|
|
||||||
# Format to use for the generated SBOM output. Supported formats are
|
|
||||||
# "spdx" and "cyclonedx". Ignored if "sbom-path" is specified. Defaults to
|
|
||||||
# "spdx".
|
|
||||||
sbom-format:
|
|
||||||
|
|
||||||
# Whether to push the attestation to the image registry. Requires that the
|
# Whether to push the attestation to the image registry. Requires that the
|
||||||
# "subject-name" parameter specify the fully-qualified image name and that
|
# "subject-name" parameter specify the fully-qualified image name and that
|
||||||
# the "subject-digest" parameter be specified. Defaults to false.
|
# the "subject-digest" parameter be specified. Defaults to false.
|
||||||
push-to-registry:
|
push-to-registry:
|
||||||
|
|
||||||
|
# Whether to attach a list of generated attestations to the workflow run
|
||||||
|
# summary page. Defaults to true.
|
||||||
|
show-summary:
|
||||||
|
|
||||||
# The GitHub token used to make authenticated API requests. Default is
|
# The GitHub token used to make authenticated API requests. Default is
|
||||||
# ${{ github.token }}
|
# ${{ github.token }}
|
||||||
github-token:
|
github-token:
|
||||||
@@ -101,16 +115,31 @@ See [action.yml](action.yml)
|
|||||||
<!-- markdownlint-disable MD013 -->
|
<!-- markdownlint-disable MD013 -->
|
||||||
|
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
| ------------- | -------------------------------------------------------------- | ----------------------- |
|
| ----------------- | -------------------------------------------------------------- | ------------------------------------------------ |
|
||||||
| `bundle-path` | Absolute path to the file containing the generated attestation | `/tmp/attestaion.jsonl` |
|
| `attestation-id` | GitHub ID for the attestation | `123456` |
|
||||||
|
| `attestation-url` | URL for the attestation summary | `https://github.com/foo/bar/attestations/123456` |
|
||||||
|
| `bundle-path` | Absolute path to the file containing the generated attestation | `/tmp/attestation.json` |
|
||||||
|
|
||||||
<!-- markdownlint-enable MD013 -->
|
<!-- markdownlint-enable MD013 -->
|
||||||
|
|
||||||
Attestations are saved in the JSON-serialized [Sigstore bundle][8] format.
|
Attestations are saved in the JSON-serialized [Sigstore bundle][8] format.
|
||||||
|
|
||||||
If multiple subjects are being attested at the same time, each attestation will
|
If multiple subjects are being attested at the same time, a single attestation
|
||||||
be written to the output file on a separate line (using the [JSON Lines][9]
|
will be created with references to each of the supplied subjects.
|
||||||
format).
|
|
||||||
|
The absolute path to the generated attestation is appended to the file
|
||||||
|
`${RUNNER_TEMP}/created_attestation_paths.txt`. This file will accumulate the
|
||||||
|
paths to all attestations created over the course of a single workflow.
|
||||||
|
|
||||||
|
## Attestation Limits
|
||||||
|
|
||||||
|
### Subject Limits
|
||||||
|
|
||||||
|
No more than 1024 subjects can be attested at the same time.
|
||||||
|
|
||||||
|
### SBOM Limits
|
||||||
|
|
||||||
|
The SBOM supplied via the `sbom-path` input cannot exceed 16MB.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -128,9 +157,11 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: write
|
contents: read
|
||||||
|
attestations: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -138,21 +169,24 @@ jobs:
|
|||||||
- name: Build artifact
|
- name: Build artifact
|
||||||
run: make my-app
|
run: make my-app
|
||||||
- name: Generate SBOM
|
- name: Generate SBOM
|
||||||
run: make sbom
|
uses: anchore/sbom-action@v0
|
||||||
|
with:
|
||||||
|
format: 'spdx-json'
|
||||||
|
output-file: 'sbom.spdx.json'
|
||||||
- name: Attest
|
- name: Attest
|
||||||
uses: actions/attest-sbom@v1
|
uses: actions/attest-sbom@v2
|
||||||
with:
|
with:
|
||||||
subject-path: '${{ github.workspace }}/my-app'
|
subject-path: '${{ github.workspace }}/my-app'
|
||||||
sbom-path: '${{ github.workspace }}/my-app.sbom.spdx.json'
|
sbom-path: 'sbom.spdx.json'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Identify Subjects by Wildcard
|
### Identify Multiple Subjects
|
||||||
|
|
||||||
If you are generating multiple artifacts, you can generate an attestation for
|
If you are generating multiple artifacts, you can attest all of them at the same
|
||||||
each by using a wildcard in the `subject-path` input.
|
time by using a wildcard in the `subject-path` input.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest-sbom@v1
|
- uses: actions/attest-sbom@v2
|
||||||
with:
|
with:
|
||||||
subject-path: 'dist/**/my-bin-*'
|
subject-path: 'dist/**/my-bin-*'
|
||||||
sbom-path: '${{ github.workspace }}/my-bin.sbom.spdx.json'
|
sbom-path: '${{ github.workspace }}/my-bin.sbom.spdx.json'
|
||||||
@@ -161,6 +195,58 @@ each by using a wildcard in the `subject-path` input.
|
|||||||
For supported wildcards along with behavior and documentation, see
|
For supported wildcards along with behavior and documentation, see
|
||||||
[@actions/glob][10] which is used internally to search for files.
|
[@actions/glob][10] which is used internally to search for files.
|
||||||
|
|
||||||
|
Alternatively, you can explicitly list multiple subjects with either a comma or
|
||||||
|
newline delimited list:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/attest-sbom@v2
|
||||||
|
with:
|
||||||
|
subject-path: 'dist/foo, dist/bar'
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/attest-sbom@v2
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
dist/foo
|
||||||
|
dist/bar
|
||||||
|
```
|
||||||
|
|
||||||
|
### Identify Subjects with Checksums File
|
||||||
|
|
||||||
|
If you are using tools like
|
||||||
|
[goreleaser](https://goreleaser.com/customization/checksum/) or
|
||||||
|
[jreleaser](https://jreleaser.org/guide/latest/reference/checksum.html) which
|
||||||
|
generate a checksums file you can identify the attestation subjects by passing
|
||||||
|
the path of the checksums file to the `subject-checksums` input. Each of the
|
||||||
|
artifacts identified in the checksums file will be listed as a subject for the
|
||||||
|
attestation.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Calculate artifact digests
|
||||||
|
run: |
|
||||||
|
shasum -a 256 foo_0.0.1_* > subject.checksums.txt
|
||||||
|
- uses: actions/attest-sbom@v2
|
||||||
|
with:
|
||||||
|
subject-checksums: subject.checksums.txt
|
||||||
|
sbom-path: sbom.spdx.json
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- markdownlint-disable MD038 -->
|
||||||
|
|
||||||
|
The file referenced by the `subject-checksums` input must conform to the same
|
||||||
|
format used by the shasum tools. Each subject should be listed on a separate
|
||||||
|
line including the hex-encoded digest (either SHA256 or SHA512), a space, a
|
||||||
|
single character flag indicating either binary (`*`) or text (` `) input mode,
|
||||||
|
and the filename.
|
||||||
|
|
||||||
|
<!-- markdownlint-enable MD038 -->
|
||||||
|
|
||||||
|
```text
|
||||||
|
b569bf992b287f55d78bf8ee476497e9b7e9d2bf1c338860bfb905016218c740 foo_0.0.1_darwin_amd64
|
||||||
|
a54fc515e616cac7fcf11a49d5c5ec9ec315948a5935c1e11dd610b834b14dde foo_0.0.1_darwin_arm64
|
||||||
|
```
|
||||||
|
|
||||||
### Container Image
|
### Container Image
|
||||||
|
|
||||||
When working with container images you can invoke the action with the
|
When working with container images you can invoke the action with the
|
||||||
@@ -188,7 +274,8 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
packages: write
|
packages: write
|
||||||
contents: write
|
contents: read
|
||||||
|
attestations: write
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
@@ -210,9 +297,13 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
- name: Generate SBOM
|
- name: Generate SBOM
|
||||||
run: make sbom
|
uses: anchore/sbom-action@v0
|
||||||
|
with:
|
||||||
|
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
format: 'cyclonedx-json'
|
||||||
|
output-file: 'sbom.cyclonedx.json'
|
||||||
- name: Attest
|
- name: Attest
|
||||||
uses: actions/attest-sbom@v1
|
uses: actions/attest-sbom@v2
|
||||||
id: attest
|
id: attest
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
@@ -223,12 +314,12 @@ jobs:
|
|||||||
|
|
||||||
[1]: https://github.com/actions/toolkit/tree/main/packages/attest
|
[1]: https://github.com/actions/toolkit/tree/main/packages/attest
|
||||||
[2]: https://github.com/in-toto/attestation/tree/main/spec/v1
|
[2]: https://github.com/in-toto/attestation/tree/main/spec/v1
|
||||||
[3]: https://github.com/anchore/sbom-action
|
|
||||||
[4]: https://spdx.dev/
|
[4]: https://spdx.dev/
|
||||||
[5]: https://cyclonedx.org/
|
[5]: https://cyclonedx.org/
|
||||||
[6]: https://www.sigstore.dev/
|
[6]: https://www.sigstore.dev/
|
||||||
[7]: https://cli.github.com/
|
[7]: https://cli.github.com/manual/gh_attestation_verify
|
||||||
[8]:
|
[8]:
|
||||||
https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto
|
https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto
|
||||||
[9]: https://jsonlines.org/
|
|
||||||
[10]: https://github.com/actions/toolkit/tree/main/packages/glob#patterns
|
[10]: https://github.com/actions/toolkit/tree/main/packages/glob#patterns
|
||||||
|
[11]:
|
||||||
|
https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
|
||||||
|
|||||||
37
RELEASE.md
Normal file
37
RELEASE.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Release Instructions
|
||||||
|
|
||||||
|
Follow the steps below to tag a new release for the `actions/attest-sbom`
|
||||||
|
action.
|
||||||
|
|
||||||
|
If changes were made to the internal `actions/attest-sbom/predicate` action (any
|
||||||
|
updates to [`./predicate/action.yaml`](./predicate/action.yml) or any of the
|
||||||
|
code in the [`./src`](./src) directory), start with step #1; otherwise, skip
|
||||||
|
directly to step #5.
|
||||||
|
|
||||||
|
1. Merge the latest changes to the `main` branch.
|
||||||
|
1. Create and push a new predicate tag of the form `predicate@X.X.X` following
|
||||||
|
SemVer conventions:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git tag -a "predicate@X.X.X" -m "predicate@X.X.X Release"
|
||||||
|
git push --tags
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Update the reference to the `actions/attest-sbom/predicate` action in
|
||||||
|
[`action.yml`](./action.yml) to point to the SHA of the newly created tag.
|
||||||
|
1. Push the `action.yml` change and open a PR. Once it has been reviewed, merge
|
||||||
|
the PR and proceed with the release instructions.
|
||||||
|
1. Create a new release for the top-level action using a tag of the form
|
||||||
|
`vX.X.X` following SemVer conventions:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
gh release create vX.X.X
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Move (or create) the major version tag to point to the same commit tagged
|
||||||
|
above:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git tag -fa vX -m "vX"
|
||||||
|
git push origin vX --force
|
||||||
|
```
|
||||||
@@ -6,10 +6,7 @@
|
|||||||
"documentNamespace": "https://anchore.com/syft/dir/80b363b6-87f4-4162-853f-60d402537d20",
|
"documentNamespace": "https://anchore.com/syft/dir/80b363b6-87f4-4162-853f-60d402537d20",
|
||||||
"creationInfo": {
|
"creationInfo": {
|
||||||
"licenseListVersion": "3.22",
|
"licenseListVersion": "3.22",
|
||||||
"creators": [
|
"creators": ["Organization: Anchore, Inc", "Tool: syft-0.103.1"],
|
||||||
"Organization: Anchore, Inc",
|
|
||||||
"Tool: syft-0.103.1"
|
|
||||||
],
|
|
||||||
"created": "2024-01-31T18:22:50Z"
|
"created": "2024-01-31T18:22:50Z"
|
||||||
},
|
},
|
||||||
"packages": [
|
"packages": [
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import * as main from '../src/main'
|
|||||||
const runMock = jest.spyOn(main, 'run').mockImplementation()
|
const runMock = jest.spyOn(main, 'run').mockImplementation()
|
||||||
|
|
||||||
describe('index', () => {
|
describe('index', () => {
|
||||||
it('calls run when imported', async () => {
|
it('calls run when imported', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
require('../src/index')
|
require('../src/index')
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe('SBOM Action', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fs.rmdirSync(tempDir, { recursive: true })
|
fs.rmSync(tempDir, { recursive: true })
|
||||||
outputs = {}
|
outputs = {}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe('parseSBOMFromPath', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fs.rmdirSync(tempDir, { recursive: true })
|
fs.rmSync(tempDir, { recursive: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('correctly parses an SPDX file', async () => {
|
it('correctly parses an SPDX file', async () => {
|
||||||
@@ -108,6 +108,13 @@ describe('generateSBOMPredicate', () => {
|
|||||||
expect(result.params).toEqual(sbom.object)
|
expect(result.params).toEqual(sbom.object)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('throws an error for missing SPDX version', () => {
|
||||||
|
const sbom = { type: 'spdx' } as SBOM
|
||||||
|
expect(() => generateSBOMPredicate(sbom)).toThrow(
|
||||||
|
'Cannot find spdxVersion in the SBOM'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it('generates CycloneDX predicate correctly', () => {
|
it('generates CycloneDX predicate correctly', () => {
|
||||||
const sbom = { type: 'cyclonedx', object: {} } as SBOM
|
const sbom = { type: 'cyclonedx', object: {} } as SBOM
|
||||||
const result = generateSBOMPredicate(sbom)
|
const result = generateSBOMPredicate(sbom)
|
||||||
@@ -116,10 +123,8 @@ describe('generateSBOMPredicate', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('throws error for unsupported SBOM formats', () => {
|
it('throws error for unsupported SBOM formats', () => {
|
||||||
const sbom = { type: 'spdx', object: {} }
|
const sbom = { type: 'foo', object: {} }
|
||||||
// @ts-expect-error test error case
|
// @ts-expect-error test error case
|
||||||
expect(() => generateSBOMPredicate(sbom)).toThrow(
|
expect(() => generateSBOMPredicate(sbom)).toThrow('Unsupported SBOM format')
|
||||||
'Cannot find spdxVersion in the SBOM'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
93
action.yml
93
action.yml
@@ -1,41 +1,39 @@
|
|||||||
name: 'Attest SBOM'
|
name: 'Attest SBOM'
|
||||||
description: 'Generate SBOM attestations for build artifacts'
|
description: 'Generate SBOM attestations for build artifacts'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
|
branding:
|
||||||
|
color: 'blue'
|
||||||
|
icon: 'paperclip'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
subject-path:
|
subject-path:
|
||||||
description: >
|
description: >
|
||||||
Path to the artifact serving as the subject of the attestation. Must
|
Path to the artifact serving as the subject of the attestation. Must
|
||||||
specify exactly one of "subject-path" or "subject-digest".
|
specify exactly one of "subject-path", "subject-digest", or
|
||||||
|
"subject-checksums". May contain a glob pattern or list of paths (total
|
||||||
|
subject count cannot exceed 1024).
|
||||||
required: false
|
required: false
|
||||||
subject-digest:
|
subject-digest:
|
||||||
description: >
|
description: >
|
||||||
SHA256 digest of the subject for for the attestation. Must be in the form
|
SHA256 digest of the subject for the attestation. Must be in the form
|
||||||
"sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one of
|
"sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one of
|
||||||
"subject-path" or "subject-digest".
|
"subject-path", "subject-digest", or "subject-checksums".
|
||||||
required: false
|
required: false
|
||||||
subject-name:
|
subject-name:
|
||||||
description: >
|
description: >
|
||||||
Subject name as it should appear in the attestation. Required unless
|
Subject name as it should appear in the attestation. Required when
|
||||||
"subject-path" is specified, in which case it will be inferred from the
|
identifying the subject with the "subject-digest" input.
|
||||||
path.
|
subject-checksums:
|
||||||
|
description: >
|
||||||
|
Path to checksums file containing digest and name of subjects for
|
||||||
|
attestation. Must specify exactly one of "subject-path", "subject-digest",
|
||||||
|
or "subject-checksums".
|
||||||
|
required: false
|
||||||
sbom-path:
|
sbom-path:
|
||||||
description: >
|
description: >
|
||||||
Path to the JSON-formatted SBOM file to attest. When specified, the
|
Path to the JSON-formatted SBOM file to attest. File size cannot exceed
|
||||||
"scan-path" and "sbom-format" inputs are ignored.
|
16MB.
|
||||||
required: false
|
required: true
|
||||||
scan-path:
|
|
||||||
description: >
|
|
||||||
Path on the filesystem to scan for SBOM generation. Ignored if "sbom-path"
|
|
||||||
is specified.
|
|
||||||
default: ${{ github.workspace }}
|
|
||||||
required: false
|
|
||||||
sbom-format:
|
|
||||||
description: >
|
|
||||||
Format to use for the generated SBOM output. Supported formats are "spdx"
|
|
||||||
and "cyclonedx". Ignored if "sbom-path" is specified.
|
|
||||||
default: 'spdx'
|
|
||||||
required: false
|
|
||||||
push-to-registry:
|
push-to-registry:
|
||||||
description: >
|
description: >
|
||||||
Whether to push the provenance statement to the image registry. Requires
|
Whether to push the provenance statement to the image registry. Requires
|
||||||
@@ -43,58 +41,49 @@ inputs:
|
|||||||
and that the "subject-digest" parameter be specified. Defaults to false.
|
and that the "subject-digest" parameter be specified. Defaults to false.
|
||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
|
show-summary:
|
||||||
|
description: >
|
||||||
|
Whether to attach a list of generated attestations to the workflow run
|
||||||
|
summary page. Defaults to true.
|
||||||
|
default: true
|
||||||
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description: >
|
description: >
|
||||||
The GitHub token used to make authenticated API requests.
|
The GitHub token used to make authenticated API requests.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
bundle-path:
|
bundle-path:
|
||||||
description: 'The path to the file containing the attestation bundle(s).'
|
description: 'The path to the file containing the attestation bundle.'
|
||||||
value: ${{ steps.attest.outputs.bundle-path }}
|
value: ${{ steps.attest.outputs.bundle-path }}
|
||||||
|
attestation-id:
|
||||||
|
description: 'The ID of the attestation.'
|
||||||
|
value: ${{ steps.attest.outputs.attestation-id }}
|
||||||
|
attestation-url:
|
||||||
|
description: 'The URL for the attestation summary.'
|
||||||
|
value: ${{ steps.attest.outputs.attestation-url }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Generate random SBOM output file name
|
- uses: actions/attest-sbom/predicate@534423496eab34674190bc45fdacbb8b1198e07f # predicate@1.0.0
|
||||||
if: inputs.sbom-path == ''
|
|
||||||
id: sbom-output
|
|
||||||
run:
|
|
||||||
echo "path=${{ runner.temp }}/sbom_$(openssl rand -hex 6).json" >> $GITHUB_OUTPUT
|
|
||||||
shell: bash
|
|
||||||
- name: SBOM format check
|
|
||||||
id: check-sbom-format
|
|
||||||
if: inputs.sbom-path == ''
|
|
||||||
run: |
|
|
||||||
if [ "${{inputs.sbom-format}}" != "spdx" ] && [ "${{inputs.sbom-format}}" != "cyclonedx" ] ]; then
|
|
||||||
echo "Invalid SBOM format. Supported formats are spdx and cyclonedx."
|
|
||||||
exit 1
|
|
||||||
elif [ "${{inputs.sbom-format}}" == "spdx" ]; then
|
|
||||||
echo "format=spdx-json" >> $GITHUB_OUTPUT
|
|
||||||
elif [ "${{inputs.sbom-format}}" == "cyclonedx" ]; then
|
|
||||||
echo "format=cyclonedx-json" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
- name: Generate SBOM
|
|
||||||
if: inputs.sbom-path == ''
|
|
||||||
uses: anchore/sbom-action@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8
|
|
||||||
with:
|
|
||||||
path: ${{ inputs.scan-path }}
|
|
||||||
output-file: ${{ steps.sbom-output.outputs.path }}
|
|
||||||
format: ${{ steps.check-sbom-format.outputs.format }}
|
|
||||||
- uses: actions/attest-sbom/predicate@main
|
|
||||||
id: generate-sbom-predicate
|
id: generate-sbom-predicate
|
||||||
with:
|
with:
|
||||||
sbom-path: ${{ inputs.sbom-path || steps.sbom-output.outputs.path }}
|
sbom-path: ${{ inputs.sbom-path }}
|
||||||
- uses: actions/attest@main
|
- uses: actions/attest@daf44fb950173508f38bd2406030372c1d1162b1 # v3.0.0
|
||||||
id: attest
|
id: attest
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: '--max-http-header-size=32768'
|
||||||
with:
|
with:
|
||||||
subject-path: ${{ inputs.subject-path }}
|
subject-path: ${{ inputs.subject-path }}
|
||||||
subject-digest: ${{ inputs.subject-digest }}
|
subject-digest: ${{ inputs.subject-digest }}
|
||||||
subject-name: ${{ inputs.subject-name }}
|
subject-name: ${{ inputs.subject-name }}
|
||||||
push-to-registry: ${{ inputs.push-to-registry }}
|
subject-checksums: ${{ inputs.subject-checksums }}
|
||||||
predicate-type:
|
predicate-type:
|
||||||
${{ steps.generate-sbom-predicate.outputs.predicate-type }}
|
${{ steps.generate-sbom-predicate.outputs.predicate-type }}
|
||||||
predicate-path:
|
predicate-path:
|
||||||
${{ steps.generate-sbom-predicate.outputs.predicate-path }}
|
${{ steps.generate-sbom-predicate.outputs.predicate-path }}
|
||||||
|
push-to-registry: ${{ inputs.push-to-registry }}
|
||||||
|
show-summary: ${{ inputs.show-summary }}
|
||||||
github-token: ${{ inputs.github-token }}
|
github-token: ${{ inputs.github-token }}
|
||||||
|
|||||||
3686
dist/index.js
generated
vendored
3686
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
37
dist/licenses.txt
generated
vendored
37
dist/licenses.txt
generated
vendored
@@ -10,6 +10,18 @@ The above copyright notice and this permission notice shall be included in all c
|
|||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
@actions/exec
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
@actions/http-client
|
@actions/http-client
|
||||||
MIT
|
MIT
|
||||||
Actions Http Client for Node.js
|
Actions Http Client for Node.js
|
||||||
@@ -35,6 +47,18 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
@actions/io
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
@fastify/busboy
|
@fastify/busboy
|
||||||
MIT
|
MIT
|
||||||
Copyright Brian White. All rights reserved.
|
Copyright Brian White. All rights reserved.
|
||||||
@@ -105,16 +129,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
uuid
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|||||||
92
eslint.config.mjs
Normal file
92
eslint.config.mjs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import eslint from '@eslint/js'
|
||||||
|
import importplugin from 'eslint-plugin-import'
|
||||||
|
import jestplugin from 'eslint-plugin-jest'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
// Ignore non-project files
|
||||||
|
{
|
||||||
|
name: 'ignore',
|
||||||
|
ignores: ['.github', 'dist', 'coverage', '**/*.json', 'jest.setup.js', 'eslint.config.mjs']
|
||||||
|
},
|
||||||
|
// Use recommended rules from ESLint, TypeScript, and other plugins
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommendedTypeChecked,
|
||||||
|
jestplugin.configs['flat/recommended'],
|
||||||
|
importplugin.flatConfigs.recommended,
|
||||||
|
importplugin.flatConfigs.typescript,
|
||||||
|
// Override some rules
|
||||||
|
{
|
||||||
|
name: 'project-settings',
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2023,
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.lint.json']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// eslint rules
|
||||||
|
eqeqeq: ['error', 'smart'],
|
||||||
|
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-implicit-globals': 'error',
|
||||||
|
'no-inner-declarations': 'error',
|
||||||
|
'no-invalid-this': 'error',
|
||||||
|
'no-return-assign': 'error',
|
||||||
|
'no-sequences': 'error',
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-useless-concat': 'error',
|
||||||
|
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
|
||||||
|
'one-var': ['error', 'never'],
|
||||||
|
'prefer-template': 'error',
|
||||||
|
|
||||||
|
// typescript-eslint rules
|
||||||
|
'@typescript-eslint/array-type': 'error',
|
||||||
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': [
|
||||||
|
'error',
|
||||||
|
{ allowExpressions: true }
|
||||||
|
],
|
||||||
|
'@typescript-eslint/explicit-member-accessibility': [
|
||||||
|
'error',
|
||||||
|
{ accessibility: 'no-public' }
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-extraneous-class': 'error',
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||||
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||||
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'error',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'warn',
|
||||||
|
'@typescript-eslint/prefer-function-type': 'warn',
|
||||||
|
'@typescript-eslint/prefer-includes': 'error',
|
||||||
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||||
|
'@typescript-eslint/promise-function-async': 'error',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||||
|
|
||||||
|
// eslint-plugin-import rules
|
||||||
|
'import/extensions': 'error',
|
||||||
|
'import/first': 'error',
|
||||||
|
'import/no-absolute-path': 'error',
|
||||||
|
'import/no-commonjs': 'error',
|
||||||
|
'import/no-deprecated': 'warn',
|
||||||
|
'import/no-dynamic-require': 'error',
|
||||||
|
'import/no-extraneous-dependencies': 'error',
|
||||||
|
'import/no-mutable-exports': 'error',
|
||||||
|
'import/no-namespace': 'off',
|
||||||
|
'import/no-unresolved': ['error', { ignore: ['csv-parse/sync'] }],
|
||||||
|
'import/no-anonymous-default-export': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAnonymousClass: false,
|
||||||
|
allowAnonymousFunction: false,
|
||||||
|
allowArray: true,
|
||||||
|
allowArrowFunction: false,
|
||||||
|
allowLiteral: true,
|
||||||
|
allowObject: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
8003
package-lock.json
generated
8003
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
55
package.json
55
package.json
@@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"name": "typescript-action",
|
"name": "actions/attest-sbom",
|
||||||
"description": "GitHub Actions TypeScript template",
|
"description": "Generate signed SBOM attestations",
|
||||||
"version": "0.0.0",
|
"version": "2.0.0",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://github.com/actions/typescript-action",
|
"homepage": "https://github.com/actions/attest-sbom",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/actions/typescript-action.git"
|
"url": "git+https://github.com/actions/attest-sbom.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/typescript-action/issues"
|
"url": "https://github.com/actions/attest-sbom/issues"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
"node",
|
"attestation",
|
||||||
"setup"
|
"sbom"
|
||||||
],
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.js"
|
".": "./dist/index.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=24"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bundle": "npm run format:write && npm run package",
|
"bundle": "npm run format:write && npm run package",
|
||||||
"ci-test": "jest",
|
"ci-test": "jest",
|
||||||
"format:write": "prettier --write **/*.ts",
|
"format:write": "prettier --write **/*.ts",
|
||||||
"format:check": "prettier --check **/*.ts",
|
"format:check": "prettier --check **/*.ts",
|
||||||
"lint:eslint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
|
"lint:eslint": "npx eslint",
|
||||||
"lint:markdown": "npx markdownlint --config .github/linters/.markdown-lint.yml \"*.md\"",
|
"lint:markdown": "npx markdownlint --config .markdown-lint.yml \"*.md\"",
|
||||||
"lint": "npm run lint:eslint && npm run lint:markdown",
|
"lint": "npm run lint:eslint && npm run lint:markdown",
|
||||||
"package": "ncc build src/index.ts --license licenses.txt",
|
"package": "ncc build src/index.ts --license licenses.txt",
|
||||||
"package:watch": "npm run package -- --watch",
|
"package:watch": "npm run package -- --watch",
|
||||||
@@ -70,25 +70,22 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1"
|
"@actions/core": "^1.11.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/attest": "^1.0.0",
|
"@actions/attest": "^1.6.0",
|
||||||
"@types/jest": "^29.5.12",
|
"@eslint/js": "^9.34.0",
|
||||||
"@types/node": "^20.11.24",
|
"@types/jest": "^30.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
"@types/node": "^24.3.0",
|
||||||
"@typescript-eslint/parser": "^6.21.0",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"eslint": "^9.34.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
"eslint-plugin-github": "^4.10.2",
|
"eslint-plugin-jest": "^29.0.1",
|
||||||
"eslint-plugin-jest": "^27.9.0",
|
"jest": "^30.1.1",
|
||||||
"eslint-plugin-jsonc": "^2.13.0",
|
"markdownlint-cli": "^0.45.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"prettier": "^3.6.2",
|
||||||
"jest": "^29.7.0",
|
"ts-jest": "^29.4.1",
|
||||||
"markdownlint-cli": "^0.39.0",
|
"typescript": "^5.9.2",
|
||||||
"prettier": "^3.2.5",
|
"typescript-eslint": "^8.41.0"
|
||||||
"prettier-eslint": "^16.3.0",
|
|
||||||
"ts-jest": "^29.1.2",
|
|
||||||
"typescript": "^5.3.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ outputs:
|
|||||||
description: >
|
description: >
|
||||||
URI identifying the type of the predicate.
|
URI identifying the type of the predicate.
|
||||||
runs:
|
runs:
|
||||||
using: node20
|
using: node24
|
||||||
main: ../dist/index.js
|
main: ../dist/index.js
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# About:
|
|
||||||
#
|
|
||||||
# This is a helper script to tag and push a new release. GitHub Actions use
|
|
||||||
# release tags to allow users to select a specific version of the action to use.
|
|
||||||
#
|
|
||||||
# See: https://github.com/actions/typescript-action#publishing-a-new-release
|
|
||||||
#
|
|
||||||
# This script will do the following:
|
|
||||||
#
|
|
||||||
# 1. Get the latest release tag
|
|
||||||
# 2. Prompt the user for a new release tag
|
|
||||||
# 3. Tag the new release
|
|
||||||
# 4. Push the new tag to the remote
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# script/release
|
|
||||||
|
|
||||||
# Terminal colors
|
|
||||||
OFF='\033[0m'
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
BLUE='\033[0;34m'
|
|
||||||
|
|
||||||
# Get the latest release tag
|
|
||||||
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
|
||||||
|
|
||||||
if [[ -z "$latest_tag" ]]; then
|
|
||||||
# There are no existing release tags
|
|
||||||
echo -e "No tags found (yet) - Continue to create and push your first tag"
|
|
||||||
latest_tag="[unknown]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Display the latest release tag
|
|
||||||
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
|
|
||||||
|
|
||||||
# Prompt the user for the new release tag
|
|
||||||
read -r -p 'Enter a new release tag (vX.X.X format): ' new_tag
|
|
||||||
|
|
||||||
# Validate the new release tag
|
|
||||||
tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
|
|
||||||
if echo "$new_tag" | grep -q -E "$tag_regex"; then
|
|
||||||
echo -e "Tag: ${BLUE}$new_tag${OFF} is valid"
|
|
||||||
else
|
|
||||||
# Release tag is not `vX.X.X` format
|
|
||||||
echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Tag the new release
|
|
||||||
git tag -a "$new_tag" -m "$new_tag Release"
|
|
||||||
echo -e "${GREEN}Tagged: $new_tag${OFF}"
|
|
||||||
|
|
||||||
# Push the new tag to the remote
|
|
||||||
git push --tags
|
|
||||||
echo -e "${GREEN}Release tag pushed to remote${OFF}"
|
|
||||||
echo -e "${GREEN}Done!${OFF}"
|
|
||||||
11
src/sbom.ts
11
src/sbom.ts
@@ -12,7 +12,7 @@ export async function parseSBOMFromPath(filePath: string): Promise<SBOM> {
|
|||||||
// Read the file content
|
// Read the file content
|
||||||
const fileContent = await fs.promises.readFile(filePath, 'utf8')
|
const fileContent = await fs.promises.readFile(filePath, 'utf8')
|
||||||
|
|
||||||
const sbom = JSON.parse(fileContent)
|
const sbom = JSON.parse(fileContent) as object
|
||||||
|
|
||||||
if (checkIsSPDX(sbom)) {
|
if (checkIsSPDX(sbom)) {
|
||||||
return { type: 'spdx', object: sbom }
|
return { type: 'spdx', object: sbom }
|
||||||
@@ -66,13 +66,14 @@ export const storePredicate = (predicate: Predicate): string => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const generateSBOMPredicate = (sbom: SBOM): Predicate => {
|
export const generateSBOMPredicate = (sbom: SBOM): Predicate => {
|
||||||
if (sbom.type === 'spdx') {
|
switch (sbom.type) {
|
||||||
|
case 'spdx':
|
||||||
return generateSPDXIntoto(sbom.object)
|
return generateSPDXIntoto(sbom.object)
|
||||||
}
|
case 'cyclonedx':
|
||||||
if (sbom.type === 'cyclonedx') {
|
|
||||||
return generateCycloneDXIntoto(sbom.object)
|
return generateCycloneDXIntoto(sbom.object)
|
||||||
}
|
default:
|
||||||
throw new Error('Unsupported SBOM format')
|
throw new Error('Unsupported SBOM format')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ref: https://github.com/in-toto/attestation/blob/main/spec/predicates/spdx.md
|
// ref: https://github.com/in-toto/attestation/blob/main/spec/predicates/spdx.md
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
|
"isolatedModules": true,
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
|||||||
9
tsconfig.lint.json
Normal file
9
tsconfig.lint.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": ["./__tests__/**/*", "./src/**/*"],
|
||||||
|
"exclude": ["./dist", "./node_modules", "./coverage", "*.json"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user