Skip to content

Commit 607296a

Browse files
authored
action: implement and document bundle-only (#49)
* action: implement and document `bundle-only` Signed-off-by: Andrew Pan <[email protected]> * workflows/release: enable `bundle-only` Signed-off-by: Andrew Pan <[email protected]> --------- Signed-off-by: Andrew Pan <[email protected]>
1 parent 7643db0 commit 607296a

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ jobs:
2424
with:
2525
inputs: action.yml action.py
2626
release-signing-artifacts: true
27+
bundle-only: true

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,29 @@ permissions:
388388
release-signing-artifacts: true
389389
```
390390

391+
### `bundle-only`
392+
393+
**Default**: `false`
394+
395+
The `bundle-only` setting controls whether or not `sigstore-python` uploads `.crt`
396+
or `.sig` artifacts.
397+
398+
This setting affects the behavior of the `upload-signing-artifacts` and `release-signing-artifacts`
399+
settings. If neither of those settings are specified, this setting has no effect.
400+
401+
By default, `.crt` and `.sig` artifacts are uploaded. If enabled, only the `.sigstore`
402+
signing artifact is uploaded.
403+
404+
Example:
405+
406+
```yaml
407+
- uses: sigstore/[email protected]
408+
with:
409+
inputs: file.txt
410+
upload-signing-artifacts: true
411+
bundle-only: true
412+
```
413+
391414
### Internal options
392415
<details>
393416
<summary>⚠️ Internal options ⚠️</summary>

action.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def _fatal_help(msg):
188188
signing_artifact_paths.append(artifact)
189189
inputs.append(artifact)
190190

191+
bundle_only = os.getenv("GHA_SIGSTORE_PYTHON_BUNDLE_ONLY") == "true"
191192
for input_ in inputs:
192193
# Forbid things that look like flags. This isn't a security boundary; just
193194
# a way to prevent (less motivated) users from breaking the action on themselves.
@@ -199,9 +200,9 @@ def _fatal_help(msg):
199200
for file_ in files:
200201
if not file_.is_file():
201202
_fatal_help(f"input {file_} does not look like a file")
202-
if "--certificate" not in sigstore_sign_args:
203+
if not bundle_only and "--certificate" not in sigstore_sign_args:
203204
signing_artifact_paths.append(f"{file_}.crt")
204-
if "--signature" not in sigstore_sign_args:
205+
if not bundle_only and "--signature" not in sigstore_sign_args:
205206
signing_artifact_paths.append(f"{file_}.sig")
206207
if "--bundle" not in sigstore_sign_args:
207208
signing_artifact_paths.append(f"{file_}.sigstore")

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ inputs:
9090
description: "attach all signing artifacts as release assets"
9191
required: false
9292
default: false
93+
bundle-only:
94+
description: |
95+
upload only the Sigstore bundle
96+
97+
has no effect if `upload-signing-artifacts` or `release-signing-artifacts` is not enabled
98+
required: false
99+
default: false
93100
internal-be-careful-debug:
94101
description: "run with debug logs (default false)"
95102
required: false
@@ -124,6 +131,7 @@ runs:
124131
GHA_SIGSTORE_PYTHON_VERIFY_CERT_IDENTITY: "${{ inputs.verify-cert-identity }}"
125132
GHA_SIGSTORE_PYTHON_VERIFY_OIDC_ISSUER: "${{ inputs.verify-oidc-issuer }}"
126133
GHA_SIGSTORE_PYTHON_RELEASE_SIGNING_ARTIFACTS: "${{ inputs.release-signing-artifacts }}"
134+
GHA_SIGSTORE_PYTHON_BUNDLE_ONLY: "${{ inputs.bundle-only }}"
127135
GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG: "${{ inputs.internal-be-careful-debug }}"
128136
shell: bash
129137

0 commit comments

Comments
 (0)