Skip to content

Commit c3ae3e3

Browse files
authored
feat: Keep ref in sync for Maven Actions (#2510)
closes #2508 We need to keep in sync the checkout of the slsa-github-generator repo --------- Signed-off-by: laurentsimon <[email protected]>
1 parent cb9cea2 commit c3ae3e3

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -euo pipefail
2222

2323
# Verify the tag has semver format.
2424
cd __EXAMPLE_PACKAGE__
25+
2526
# shellcheck source=/dev/null
2627
source "./.github/workflows/scripts/e2e-utils.sh"
2728
major=$(version_major "$RELEASE_TAG")
@@ -81,6 +82,19 @@ if [[ "$results" != "" ]]; then
8182
exit 1
8283
fi
8384

85+
# Verify the Maven Actions use the correct builder ref.
86+
results=$(
87+
find actions/maven/ internal/builders/maven/ -name '*.yaml' -o -name '*.yml' -type f -print0 |
88+
xargs -0 grep -Pn "ref:(\s*(?!$RELEASE_TAG)[^\s]+)" ||
89+
true
90+
)
91+
if [[ "$results" != "" ]]; then
92+
echo "Some Maven Actions are referencing the builder at the incorrect tag \"$RELEASE_TAG\""
93+
echo "$results"
94+
exit 1
95+
fi
96+
97+
8498
if [[ "$RELEASE_TAG" =~ .*-rc\.[0-9]*$ ]]; then
8599
# don't check documentation for release candidates
86100
exit 0

.github/workflows/scripts/pre-submit.actions/references.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636

3737
# Verify our Actions are referenced at main in internal actions.
3838
results=$(
39-
find .github/actions/ -maxdepth 2 -name '*.yaml' -o -name '*.yml' -type f -print0 \
39+
find .github/actions/ -maxdepth 2 -name '*.yaml' -o -name '*.yml' -type f -print0 |
4040
xargs -0 grep -P "slsa-framework/slsa-github-generator/.*@(?!main)" ||
4141
true
4242
)
@@ -57,3 +57,17 @@ if [[ "$results" != "" ]]; then
5757
echo "$results"
5858
exit 1
5959
fi
60+
61+
# Verify the Maven Actions use the correct builder ref.
62+
results=$(
63+
find actions/maven/ internal/builders/maven/ -name '*.yaml' -o -name '*.yml' -type f -print0 |
64+
xargs -0 grep -Pn "ref:(\s*(?!main)[^\s]+)" ||
65+
true
66+
)
67+
if [[ "$results" != "" ]]; then
68+
echo "Some Maven Actions are not referencing the builder at main"
69+
echo "$results"
70+
exit 1
71+
fi
72+
73+

RELEASE.md

+3
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ Update version references with the following command:
475475

476476
```shell
477477
find .github/workflows/ .github/actions/ actions/ -name '*.yaml' -o -name '*.yml' | xargs sed -i "s/uses: slsa-framework\/slsa-github-generator\/\(.*\)@\(main\|v[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\.[0-9]\+\)\?\)/uses: slsa-framework\/slsa-github-generator\/\1@$BUILDER_TAG/"
478+
find actions/maven/ internal/builders/maven/ -name '*.yaml' -o -name '*.yml' -type f | xargs sed -i "s/\(ref:[ ]*\)main/\1$BUILDER_TAG/"
478479
```
479480

480481
Likewise, update documentation with the following command:
@@ -504,6 +505,8 @@ Send a PR to reference the Actions at `@main`. You can use:
504505

505506
```shell
506507
find .github/workflows/ .github/actions/ actions/ -name '*.yaml' -o -name '*.yml' | xargs sed -i "s/uses: slsa-framework\/slsa-github-generator\/\(.*\)@${BUILDER_TAG}/uses: slsa-framework\/slsa-github-generator\/\1@main/"
508+
find actions/maven/ internal/builders/maven/ -name '*.yaml' -o -name '*.yml' -type f | xargs sed -i "s/\(ref:[ ]*\)$BUILDER_TAG/\1main/"
509+
507510
```
508511

509512
### Update verifier

actions/maven/publish/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ runs:
7676
uses: slsa-framework/slsa-github-generator/.github/actions/secure-builder-checkout@main
7777
with:
7878
repository: slsa-framework/slsa-github-generator
79-
ref: v1.8.0
79+
ref: main
8080
path: __BUILDER_CHECKOUT_DIR__
8181

8282
- name: Publish to the Maven Central Repository

internal/builders/maven/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ runs:
6262
uses: slsa-framework/slsa-github-generator/.github/actions/secure-builder-checkout@main
6363
with:
6464
repository: slsa-framework/slsa-github-generator
65-
ref: v1.8.0
65+
ref: main
6666
path: __BUILDER_CHECKOUT_DIR__
6767
- name: Run mvn package
6868
shell: bash

0 commit comments

Comments
 (0)