-
Notifications
You must be signed in to change notification settings - Fork 25
105 lines (93 loc) · 4.04 KB
/
e2e.delegator-generic.create.main.default.slsa3.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
on:
schedule:
- cron: "0 13 * * *"
workflow_dispatch:
create:
permissions: read-all
concurrency: "e2e.delegator-generic.create.main.default.slsa3"
env:
GH_TOKEN: ${{ secrets.E2E_GENERIC_TOKEN }}
ISSUE_REPOSITORY: slsa-framework/slsa-github-generator
# BEWARE: Updateing this version requires updating the hardcoded
# v45 in the workflow.
DEFAULT_VERSION: v45.0.0
jobs:
# Bootstrap
################################################################################
bootstrap:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# Bumps the package version pushes, creates a git tag, and pushes the tag.
- run: ./.github/workflows/scripts/e2e-bootstrap.sh
if-bootstrap-failed:
runs-on: ubuntu-latest
needs: [bootstrap]
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && needs.bootstrap.result != 'success'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: ./.github/workflows/scripts/e2e-report-failure.sh
# Main workflow
################################################################################
# Shim determines if the rest of the workflow should run.
# NOTE: it should only use the `if` to determine this and all downstream jobs
# should depend on this job.
shim:
# NOTE: this must be kept in sync with the if-failed job.
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v45')
runs-on: ubuntu-latest
steps:
- run: |
echo "event: ${GITHUB_EVENT_NAME}"
echo "ref: ${GITHUB_REF}"
build:
needs: [shim]
permissions:
id-token: write # For signing
contents: write # For asset uploads
packages: write # To write to github packages
actions: read
uses: slsa-framework/example-trw/.github/workflows/[email protected]
with:
artifact: my-artifact
content: "hello world delegator_generic_slsa3"
secrets:
# NOTE: this password is set to 'delegator-password'.
password: ${{ secrets.DELEGATOR_PASSWORD }}
verify:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: "${{ needs.build.outputs.artifact }}" # NOTE: This is 'my-artifact'.
- uses: slsa-framework/example-trw/high-perms/actions/download/[email protected]
with:
name: "${{ needs.build.outputs.provenance-download-name }}"
sha256: "${{ needs.build.outputs.provenance-download-sha256 }}"
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: "1.21"
- env:
BINARY: "${{ needs.build.outputs.artifact }}"
PROVENANCE: "${{ needs.build.outputs.provenance-download-name }}/${{ needs.build.outputs.artifact }}.build.slsa" # This is defined by the builder.
BUILDER_ID: "https://github.com/slsa-framework/example-trw/.github/workflows/[email protected]"
run: ./.github/workflows/scripts/e2e.delegator.default.verify.sh
if-succeeded:
runs-on: ubuntu-latest
needs: [build, verify]
if: needs.build.result == 'success' && needs.verify.result == 'success'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: ./.github/workflows/scripts/e2e-report-success.sh
if-failed:
runs-on: ubuntu-latest
needs: [build, verify]
if: always() && github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v45') && (needs.build.result != 'success' || needs.verify.result != 'success')
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: ./.github/workflows/scripts/e2e-report-failure.sh