forked from slsa-framework/slsa-github-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (70 loc) · 2.6 KB
/
pre-submit.e2e.go.config-ldflags-main-dir.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
# Copyright 2023 SLSA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: pre-submit e2e go ldflags main dir
on:
pull_request:
branches: [main]
merge_group:
workflow_dispatch:
permissions: read-all
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
args:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ldflags.outputs.version }}
commit: ${{ steps.ldflags.outputs.commit }}
branch: ${{ steps.ldflags.outputs.branch }}
steps:
- id: ldflags
run: |
set -euo pipefail
{
echo "version=-X main.gitVersion=v1.2.3"
echo "commit=-X main.gitCommit=abcdef"
echo "branch=-X main.gitBranch=main"
} >> "$GITHUB_OUTPUT"
build:
needs: [args]
permissions:
id-token: write # For signing.
contents: write # For asset uploads.
actions: read # For the entry point.
uses: ./.github/workflows/builder_go_slsa3.yml
with:
go-version: "1.20"
config-file: .github/workflows/configs-go/config-ldflags-main-dir.yml
evaluated-envs: "VERSION:${{needs.args.outputs.version}},COMMIT:${{needs.args.outputs.commit}},BRANCH:${{needs.args.outputs.branch}}"
compile-builder: true
verify:
# NOTE: this name is used as the status check name and by protected
# branches for required status checks. It should have a unique name among
# other pre-submits.
name: verify go provenance
runs-on: ubuntu-latest
needs: [build]
if: ${{ always() }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: ${{ needs.build.outputs.go-binary-name }}
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: ${{ needs.build.outputs.go-provenance-name }}
- env:
BINARY: ${{ needs.build.outputs.go-binary-name }}
PROVENANCE: ${{ needs.build.outputs.go-provenance-name }}
run: ./.github/workflows/scripts/pre-submit.e2e.go.default.sh