@@ -29,6 +29,7 @@ project simply generates provenance as a separate step in an existing workflow.
29
29
- [ Provenance for Bazel] ( #provenance-for-bazel )
30
30
- [ Provenance for Java] ( #provenance-for-java )
31
31
- [ Provenance for Rust] ( #provenance-for-rust )
32
+ - [ Provenance for Haskell] ( #provenance-for-haskell )
32
33
33
34
---
34
35
@@ -351,7 +352,7 @@ jobs:
351
352
### Provenance for Bazel
352
353
353
354
If you use [Bazel](https://bazel.build/) to generate your artifacts, you can
354
- easily generate SLSA3 provenance by updating your existing workflow with the 4
355
+ easily generate SLSA3 provenance by updating your existing workflow with the 5
355
356
steps indicated in the workflow below:
356
357
357
358
` ` ` yaml
@@ -462,7 +463,7 @@ jobs:
462
463
run : |
463
464
# Your normal build workflow targets here
464
465
mvn clean package
465
-
466
+
466
467
# ======================================================
467
468
#
468
469
# Step 3: Save the location of the maven output files
@@ -484,7 +485,7 @@ jobs:
484
485
id : hash
485
486
run : |
486
487
echo "::set-output name=hashes::$(sha256sum ${{ steps.build.outputs.artifact_pattern }} | base64 -w0)"
487
-
488
+
488
489
- name : Upload build artifacts
489
490
uses : actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
490
491
with :
@@ -541,7 +542,7 @@ jobs:
541
542
542
543
# ========================================================
543
544
#
544
- # Step 4 : Add a step to generate the provenance subjects
545
+ # Step 3 : Add a step to generate the provenance subjects
545
546
# as shown below. Update the sha256 sum arguments
546
547
# to include all binaries that you generate
547
548
# provenance for.
@@ -553,7 +554,7 @@ jobs:
553
554
id : hash
554
555
run : |
555
556
echo "::set-output name=hashes::$(sha256sum ./build/libs/* | base64 -w0)"
556
-
557
+
557
558
- name : Upload build artifacts
558
559
uses : actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
559
560
with :
@@ -563,7 +564,7 @@ jobs:
563
564
564
565
# =========================================================
565
566
#
566
- # Step 5 : Call the generic workflow to generate provenance
567
+ # Step 4 : Call the generic workflow to generate provenance
567
568
# by declaring the job below.
568
569
#
569
570
# =========================================================
@@ -616,7 +617,7 @@ jobs:
616
617
617
618
# ========================================================
618
619
#
619
- # Step 4 : Add a step to generate the provenance subjects
620
+ # Step 3 : Add a step to generate the provenance subjects
620
621
# as shown below. Update the sha256 sum arguments
621
622
# to include all binaries that you generate
622
623
# provenance for.
@@ -631,7 +632,75 @@ jobs:
631
632
632
633
# =========================================================
633
634
#
634
- # Step 5: Call the generic workflow to generate provenance
635
+ # Step 4: Call the generic workflow to generate provenance
636
+ # by declaring the job below.
637
+ #
638
+ # =========================================================
639
+ provenance :
640
+ needs : [build]
641
+ permissions :
642
+ actions : read # To read the workflow path.
643
+ id-token : write # To sign the provenance.
644
+ contents : write # To add assets to a release.
645
+ uses :
slsa-framework/slsa-github-generator/.github/workflows/[email protected]
646
+ with :
647
+ base64-subjects : " ${{ needs.build.outputs.hashes }}"
648
+ upload-assets : true # Optional: Upload to a new release
649
+ ` ` `
650
+
651
+ ### Provenance for Haskell
652
+
653
+ If you use [Haskell](https://www.haskell.org/) (either via
654
+ [` cabal`](https://www.haskell.org/cabal/) or
655
+ [`stack`](https://docs.haskellstack.org/en/stable/README/)) to generate your
656
+ artifacts, you can easily generate SLSA3 provenance by updating your existing
657
+ workflow with the steps indicated in the workflow below.
658
+
659
+ ` ` ` yaml
660
+ jobs:
661
+ build:
662
+ # ==================================================
663
+ #
664
+ # Step 1: Declare an ` outputs` for the hashes to be
665
+ # used during the provenance steps.
666
+ #
667
+ # ==================================================
668
+ outputs :
669
+ hashes : ${{ steps.hash.outputs.hashes }}
670
+
671
+ [...]
672
+
673
+ steps :
674
+ [...]
675
+ - name : Build using Haskell
676
+ run : |
677
+ # Your normal build workflow targets here.
678
+ cabal build # or stack build
679
+
680
+ # Copy the binary to the root directory for easier reference
681
+ # For Cabal, use the following command
682
+ cp $(cabal list-bin .) .
683
+ # For Stack, use the following command instead
684
+ # cp $(stack path --local-install-root)/bin/target_binary .
685
+
686
+ # ========================================================
687
+ #
688
+ # Step 2: Add a step to generate the provenance subjects
689
+ # as shown below. Update the sha256 sum arguments
690
+ # to include all binaries that you generate
691
+ # provenance for.
692
+ #
693
+ # ========================================================
694
+ - name : Generate subject
695
+ id : hash
696
+ run : |
697
+ set -euo pipefail
698
+
699
+ echo "::set-output name=hashes::$(sha256sum target_binary | base64 -w0)"
700
+
701
+ # =========================================================
702
+ #
703
+ # Step 3: Call the generic workflow to generate provenance
635
704
# by declaring the job below.
636
705
#
637
706
# =========================================================
0 commit comments