@@ -24,14 +24,13 @@ jobs:
24
24
25
25
permissions :
26
26
contents : write
27
- id-token : write # Needed for keyless signing
28
- actions : read # Needed for provenance generation
27
+ id-token : write # Needed for keyless signing
28
+ actions : read # Needed for provenance generation
29
+ packages : write # Add this permission for attestations
30
+ attestations : write # Add permissions for attestations
29
31
30
32
steps :
31
- - name : Harden the runner (Audit all outbound calls)
32
- uses : step-security/harden-runner@v2
33
- with :
34
- egress-policy : audit
33
+ # step-security/harden-runner does not (yet) run on windows, so do not use it
35
34
36
35
- name : Checkout
37
36
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
82
81
}
83
82
Get-Content -Raw git_hash.txt
84
83
84
+ - name : Debug GitHub token and permissions
85
+ run : |
86
+ Write-Host "Checking GitHub token and permissions"
87
+ # Don't print the actual token, just check if it exists
88
+ if ([string]::IsNullOrEmpty("${{ secrets.GITHUB_TOKEN }}")) {
89
+ Write-Host "::warning::GITHUB_TOKEN is empty or not accessible"
90
+ } else {
91
+ Write-Host "GITHUB_TOKEN is available"
92
+ }
93
+
94
+ # Check if running in fork (which may have limited permissions)
95
+ if ("${{ github.repository }}" -ne "${{ github.repository_owner }}/${{ github.event.repository.name }}") {
96
+ Write-Host "::warning::Running in a fork which may have limited permissions"
97
+ }
98
+
85
99
- name : Build installer
86
100
run : |
87
101
cd windows
@@ -90,6 +104,16 @@ jobs:
90
104
ISCC.exe /dMyAppVersion=$env:VERSION ardupilot_methodic_configurator.iss
91
105
ls Output
92
106
107
+ - name : Generate GitHub Actions build provenance
108
+
109
+ with :
110
+ subject-path : windows/Output/*.exe
111
+ subject-name : ' ardupilot_methodic_configurator'
112
+ push-to-registry : false
113
+ # Use the built-in token instead of secrets
114
+ github-token : ${{ github.token }}
115
+ show-summary : true
116
+
93
117
- name : Install Cosign
94
118
uses : sigstore/cosign-installer@3454372f43399081ed03b604cb2d021dabca52bb
95
119
@@ -103,20 +127,29 @@ jobs:
103
127
$encoded = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$($hash) $_"))
104
128
$encoded
105
129
}
106
- echo "hashes=$(($hashes -join ','))" >> $env:GITHUB_OUTPUT
130
+ $hashesJoined = $hashes -join ','
131
+ "hashes=$hashesJoined" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
107
132
108
133
- name : Store Executable Path
109
134
id : exe_path
110
135
run : |
111
136
cd windows/Output
112
137
$exePath = Get-ChildItem -Filter *.exe | Select-Object -First 1 -ExpandProperty FullName
113
- echo "exe_path=$exePath" >> $env:GITHUB_OUTPUT
138
+ "exe_path=$exePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
114
139
115
140
- name : Install SLSA Verifier
116
141
run : |
117
- $version = "v2.5.1 "
142
+ $version = "v2.7.0 "
118
143
$url = "https://github.com/slsa-framework/slsa-verifier/releases/download/$version/slsa-verifier-windows-amd64.exe"
119
- Invoke-WebRequest -Uri $url -OutFile slsa-verifier.exe
144
+ Invoke-WebRequest -Uri $url -OutFile "slsa-verifier.exe"
145
+
146
+ # Verify the download was successful
147
+ if (Test-Path "slsa-verifier.exe") {
148
+ Write-Host "SLSA verifier downloaded successfully to $(Get-Location)\slsa-verifier.exe"
149
+ } else {
150
+ Write-Host "::error::Failed to download SLSA verifier"
151
+ exit 1
152
+ }
120
153
121
154
- name : Generate SLSA provenance
122
155
uses : slsa-framework/slsa-github-generator/actions/generator/generic/create-base64-subjects-from-file@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a # v2.1.0
0 commit comments