Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit fef1823

Browse files
authored
build: adding SLSA provenance generation for nupkg artifacts (#228)
**Requirements** - [ ] I have added test coverage for new or changed functionality - [ ] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** Provide links to any issues in this repository or elsewhere relating to this pull request. **Describe the solution you've provided** Provide a clear and concise description of what you expect to happen. **Describe alternatives you've considered** Provide a clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context about the pull request here.
2 parents 66482f3 + e49710e commit fef1823

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

.github/actions/full-release/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
token:
2626
description: 'The GitHub token to use for publishing documentation.'
2727
required: true
28+
outputs:
29+
hashes:
30+
description: sha256sum hashes of built artifacts
31+
value: ${{ steps.publish.outputs.hashes }}
2832

2933
runs:
3034
using: composite
@@ -59,6 +63,7 @@ runs:
5963
dll_name: ${{ inputs.dll_name }}
6064

6165
- name: Publish Nupkg
66+
id: publish
6267
uses: ./.github/actions/publish-package
6368
with:
6469
project_file: ${{ inputs.project_file }}

.github/actions/publish-package/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
dry_run:
88
description: 'Is this a dry run. If so no package will be published.'
99
required: true
10+
outputs:
11+
hashes:
12+
description: sha256sum hashes of built artifacts
13+
value: ${{ steps.hash.outputs.hashes }}
1014

1115
runs:
1216
using: composite
@@ -27,6 +31,13 @@ runs:
2731
echo "published ${pkg}"
2832
done
2933
34+
- name: Hash nuget packages
35+
id: hash
36+
if: ${{ inputs.dry_run == 'false' }}
37+
shell: bash
38+
run: |
39+
echo "hashes=$(sha256sum ./nupkgs/*.nupkg ./nupkgs/*.snupkg | base64 -w0)" >> "$GITHUB_OUTPUT"
40+
3041
- name: Dry Run Publish
3142
if: ${{ inputs.dry_run == 'true' }}
3243
shell: bash

.github/workflows/manual-publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,27 @@ on:
1313
description: 'Is this a dry run. If so no package will be published.'
1414
type: boolean
1515
required: true
16+
generate_provenance:
17+
description: 'Whether or not to generate provenance for this manual publish. Default behavior: generate only on main branch.'
18+
type: choice
19+
options:
20+
- Default
21+
- Generate
22+
- Do not generate
1623

1724
jobs:
1825
build:
1926
runs-on: ubuntu-latest
2027
permissions:
2128
id-token: write
2229
contents: write
30+
outputs:
31+
server-sdk-hashes: ${{ steps.server-sdk-release.outputs.hashes }}
32+
telemetry-hashes: ${{ steps.telemetry-release.outputs.hashes }}
2333
steps:
2434
- uses: actions/checkout@v4
2535
- uses: ./.github/actions/full-release
36+
id: server-sdk-release
2637
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk' }}
2738
with:
2839
workspace_path: 'pkgs/sdk/server'
@@ -35,6 +46,7 @@ jobs:
3546
token: ${{ secrets.GITHUB_TOKEN }}
3647

3748
- uses: ./.github/actions/full-release
49+
id: telemetry-release
3850
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' }}
3951
with:
4052
workspace_path: 'pkgs/telemetry'
@@ -45,3 +57,34 @@ jobs:
4557
dry_run: ${{ inputs.dry_run }}
4658
aws_role: ${{ vars.AWS_ROLE_ARN }}
4759
token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
release-sdk-server-provenance:
62+
needs: ['build']
63+
permissions:
64+
actions: read
65+
id-token: write
66+
contents: write
67+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
68+
if: |
69+
(inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) &&
70+
inputs.pkg_name == 'LaunchDarkly.ServerSdk'
71+
with:
72+
base64-subjects: "${{ needs.build.outputs.server-sdk-hashes }}"
73+
upload-assets: true
74+
provenance-name: ${{ 'LaunchDarkly.ServerSdk_provenance.intoto.jsonl' }}
75+
76+
77+
release-telemetry-server-provenance:
78+
needs: ['build']
79+
permissions:
80+
actions: read
81+
id-token: write
82+
contents: write
83+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
84+
if: |
85+
(inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) &&
86+
inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry'
87+
with:
88+
base64-subjects: "${{ needs.build.outputs.telemetry-hashes }}"
89+
upload-assets: true
90+
provenance-name: ${{ 'LaunchDarkly.ServerSdk.Telemetry_provenance.intoto.jsonl' }}

.github/workflows/release-please.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
outputs:
1313
package-sdk-server-released: ${{ steps.release.outputs['pkgs/sdk/server--release_created'] }}
1414
package-sdk-server-telemetry-released: ${{ steps.release.outputs['pkgs/telemetry--release_created'] }}
15+
tag_name: ${{ steps.release.outputs.tag_name }}
1516

1617
steps:
1718
- uses: google-github-actions/release-please-action@v4
@@ -28,9 +29,12 @@ jobs:
2829
contents: write
2930
pull-requests: write
3031
if: ${{ needs.release-please.outputs.package-sdk-server-released == 'true'}}
32+
outputs:
33+
hashes: ${{ steps.full-release.outputs.hashes }}
3134
steps:
3235
- uses: actions/checkout@v4
3336
- uses: ./.github/actions/full-release
37+
id: full-release
3438
with:
3539
workspace_path: 'pkgs/sdk/server'
3640
project_file: 'pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj'
@@ -41,6 +45,19 @@ jobs:
4145
aws_role: ${{ vars.AWS_ROLE_ARN }}
4246
token: ${{ secrets.GITHUB_TOKEN }}
4347

48+
release-sdk-server-provenance:
49+
needs: ['release-please', 'release-sdk-server']
50+
permissions:
51+
actions: read
52+
id-token: write
53+
contents: write
54+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
55+
with:
56+
base64-subjects: "${{ needs.release-sdk-server.outputs.hashes }}"
57+
upload-assets: true
58+
upload-tag-name: ${{ needs.release-please.outputs.tag_name }}
59+
provenance-name: ${{ format('LaunchDarkly.ServerSdk-{0}_provenance.intoto.jsonl', needs.release-please.outputs.tag_name) }}
60+
4461
release-telemetry:
4562
runs-on: ubuntu-latest
4663
needs: release-please
@@ -49,9 +66,12 @@ jobs:
4966
contents: write
5067
pull-requests: write
5168
if: ${{ needs.release-please.outputs.package-sdk-server-telemetry-released == 'true'}}
69+
outputs:
70+
hashes: ${{ steps.full-release.outputs.hashes }}
5271
steps:
5372
- uses: actions/checkout@v4
5473
- uses: ./.github/actions/full-release
74+
id: full-release
5575
with:
5676
workspace_path: 'pkgs/telemetry'
5777
project_file: 'pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj'
@@ -61,3 +81,16 @@ jobs:
6181
dry_run: false
6282
aws_role: ${{ vars.AWS_ROLE_ARN }}
6383
token: ${{ secrets.GITHUB_TOKEN }}
84+
85+
release-telemetry-provenance:
86+
needs: ['release-please', 'release-telemetry']
87+
permissions:
88+
actions: read
89+
id-token: write
90+
contents: write
91+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
92+
with:
93+
base64-subjects: "${{ needs.release-telemetry.outputs.hashes }}"
94+
upload-assets: true
95+
upload-tag-name: ${{ needs.release-please.outputs.tag_name }}
96+
provenance-name: ${{ format('LaunchDarkly.ServerSdk.Telemetry-{0}_provenance.intoto.jsonl', needs.release-please.outputs.tag_name) }}

0 commit comments

Comments
 (0)