Skip to content

Commit 20b0642

Browse files
authored
docs: update installation to cover the Action and to receive updates (#523)
docs: update installation to cover the Action and to receive updates (#523) Signed-off-by: laurentsimon <[email protected]>
1 parent ae38103 commit 20b0642

File tree

4 files changed

+42
-10
lines changed

4 files changed

+42
-10
lines changed

.github/workflows/scripts/pre-release/references.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fi
7171
# Select all version numbers following a reference to slsa-verifier that are different
7272
# from the version defined in SHA256SUM.md
7373
results=$(
74-
grep -Pon ".*?slsa-verifier.*?\d+\.\d+\.\d+" README.md |
74+
grep -Pon ".*?slsa-verifier.*?v\d+\.\d+\.\d+" README.md actions/installer/README.md |
7575
grep -v "$RELEASE_TAG$" |
7676
sed -E 's/(.*)/ \1/' || true
7777
)

README.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [Compilation from source](#compilation-from-source)
2121
- [Option 1: Install via go](#option-1-install-via-go)
2222
- [Option 2: Compile manually](#option-2-compile-manually)
23+
- [Option 3: Use the installer Action](#option-3-use-the-installer-action)
2324
- [Download the binary](#download-the-binary)
2425
- [Available options](#available-options)
2526
- [Option list](#option-list)
@@ -120,19 +121,52 @@ You have two options to install the verifier.
120121

121122
#### Option 1: Install via go
122123

123-
```
124+
If you want to install the verifier, you can run the following command:
125+
```bash
124126
$ go install github.com/slsa-framework/slsa-verifier/v2/cli/[email protected]
125127
$ slsa-verifier <options>
126128
```
127129

128-
#### Option 2: Compile manually
130+
Tools like [dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates) or [renovate](https://github.com/renovatebot/renovate) use your project's go.mod to identify the version of your Go dependencies.
131+
If you install the verifier binary in CI, we strongly recommend you create a placeholder `go.mod` containing slsa-verifier as a dependency to receive updates and keep the binary up-to-date. Use the following the steps:
132+
133+
1. Create a tooling/tooling_test.go file containing the following:
134+
```go
135+
//go:build tools
136+
// +build tools
137+
138+
package main
129139

140+
import (
141+
_ "github.com/slsa-framework/slsa-verifier/v2/cli/slsa-verifier"
142+
)
130143
```
144+
145+
1. Run the following commands in the tooling directory. (It will create a go.sum file.)
146+
```bash
147+
$ go mod init <your-project-name>-tooling
148+
$ go mod tidy
149+
```
150+
151+
1. Commit the tooling folder (containing the 3 files tooling_test.go, go.mod and go.sum) to the repository.
152+
1. To install the verifier in your CI, run the following commands:
153+
```bash
154+
$ cd tooling
155+
$ grep _ tooling_test.go | cut -f2 -d '"' | xargs -n1 -t go install
156+
```
157+
158+
#### Option 2: Compile manually
159+
160+
```bash
131161
$ git clone [email protected]:slsa-framework/slsa-verifier.git
132162
$ cd slsa-verifier && git checkout v2.0.1
133163
$ go run ./cli/slsa-verifier <options>
134164
```
135165

166+
#### Option 3: Use the installer Action
167+
168+
If you need to install the verifier to run in a GitHub workflow, use the installer Action as described in [actions/installer/README.md](./actions/installer/README.md).
169+
136170
### Download the binary
137171

138172
Download the binary from the latest release at [https://github.com/slsa-framework/slsa-verifier/releases/tag/v2.0.1](https://github.com/slsa-framework/slsa-verifier/releases/tag/v2.0.1)
@@ -141,7 +175,7 @@ Download the [SHA256SUM.md](https://github.com/slsa-framework/slsa-verifier/blob
141175

142176
Verify the checksum:
143177

144-
```
178+
```bash
145179
$ sha256sum -c --strict SHA256SUM.md
146180
slsa-verifier-linux-amd64: OK
147181
```

RELEASE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ $ sha256sum slsa-verifier-linux-amd64
110110
<the-hash> slsa-verifier-linux-amd64
111111
```
112112

113-
3. Update the latest version in the [README.md](./README.md):
113+
3. Update the latest version in the main [README.md](./README.md) and the installer Action's [actions/installer/README.md](./actions/installer/README.md):
114114

115115
```shell
116-
$ sed -i "s/v1.0.0/v1.1.1/g" ./README.md
116+
$ sed -i "s/v1.0.0/v1.1.1/g" ./README.md ./actions/installer/README.md
117117
```
118118

119119
4. Send a pull request with the changes. In the description:

actions/installer/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ For more information about SLSA in general, see [https://slsa.dev](https://slsa.
1111
To install a specific version of `slsa-verifier`, use:
1212

1313
```yaml
14-
uses: slsa-framework/slsa-verifier-installer@v1.3.0
14+
uses: slsa-framework/slsa-verifier-installer@v2.0.1
1515
```
1616
17-
See https://github.com/slsa-framework/slsa-verifier/releases for the list of available `slsa-verifier` releases.
18-
19-
For a full example workflow, see [../../.github/workflows/pre-submit.actions.yml](https://github.com/slsa-framework/slsa-verifier/.github/workflows/pre-submit.actions.yml).
17+
See https://github.com/slsa-framework/slsa-verifier/releases for the list of available `slsa-verifier` releases. Only versions greater or equal to 2.0.1 are supported.
2018

2119
This action requires using GitHub-provided Linux runners.

0 commit comments

Comments
 (0)