1414concurrency :
1515 group : " ${{ github.repository_id }}-${{ github.workflow }}"
1616 cancel-in-progress : true
17- env :
18- GITHUB_REPOSITORY_DEFAULT_BRANCH : " ${{ github.event.repository.default_branch }}"
1917
2018jobs :
2119 nightly :
2220 name : " Nightly"
2321 runs-on : ubuntu-latest
2422 if : " ${{ github.event_name == 'push' && github.ref_type == 'branch' }}"
2523 permissions :
26- contents : write # Needed to create a tag
24+ contents : write # Needed to delete a release and to modify a tag
25+ id-token : write # Needed to attest build provenance
26+ attestations : write # Needed to attest build provenance
27+ env :
28+ GITHUB_REPOSITORY_DEFAULT_BRANCH : " ${{ github.event.repository.default_branch }}"
2729
2830 steps :
2931 - name : " Checkout sources"
@@ -40,12 +42,19 @@ jobs:
4042 restore-keys : " build-"
4143 path : " cache/build"
4244 enableCrossOsArchive : true
43- - name : " Build nightly "
45+ - name : " Build the flashable OTA zip "
4446 id : " build"
4547 shell : bash
4648 run : |
47- # Building nightly ...
49+ # Building...
4850 BUILD_TYPE='oss' '${{ github.workspace }}/build.sh'
51+ - name : " Attest build provenance"
52+ id : " attest"
53+ uses : actions/attest-build-provenance@v2
54+ if : " ${{ vars.NIGHTLY_ATTESTATION == 'true' && github.run_attempt == '1' && steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
55+ with :
56+ subject-path : " ${{ steps.build.outputs.ZIP_FOLDER }}/*.zip"
57+ show-summary : false
4958 - name : " ZIP info"
5059 run : |
5160 # Retrieve informations...
5867 ZIP_IS_ALPHA='${{ steps.build.outputs.ZIP_IS_ALPHA }}'
5968 ZIP_SHA256='${{ steps.build.outputs.ZIP_SHA256 }}'
6069 ZIP_MD5='${{ steps.build.outputs.ZIP_MD5 }}'
70+ ZIP_ATTESTATION='${{ steps.attest.outputs.attestation-url }}'
6171 # Displaying informations...
6272 printf '%s\n' "::notice::Filename: ${ZIP_FILENAME:-Missing}"
6373 printf '%s\n' "::notice::Version: ${ZIP_VERSION:-Missing}"
6777 printf '%s\n' "::notice::Is alpha: ${ZIP_IS_ALPHA:-Missing}"
6878 printf '%s\n' "::notice::SHA-256: ${ZIP_SHA256:-Missing}"
6979 printf '%s\n' "::notice::MD5: ${ZIP_MD5:-Missing}"
80+ printf '%s\n' "::notice::Attestation: ${ZIP_ATTESTATION:-Missing}"
7081 : "${ZIP_FOLDER:?}" || exit "${?}"
7182 - name : " Do we need to publish the nightly build?"
7283 id : " nightly-logic"
@@ -122,13 +133,15 @@ jobs:
122133 name : " ${{ steps.build.outputs.ZIP_VERSION }} nightly"
123134 tag_name : " nightly"
124135 target_commitish : " ${{ github.sha }}"
125- body : " Latest automatically built ZIP (unstable development snapshot)\n\n SHA-256: ${{ steps.build.outputs.ZIP_SHA256 }}"
136+ body : " Latest automatically built ZIP (unstable development snapshot). \n Attestation: ${{ steps.attest.outputs.attestation-url }} \n\n SHA-256: ${{ steps.build.outputs.ZIP_SHA256 }}"
126137 append_body : false
127138 generate_release_notes : false
128139 make_latest : false
129140 draft : false
130141 prerelease : true
131- files : " ${{ steps.build.outputs.ZIP_FOLDER }}/*.zip*"
142+ files : |
143+ ${{ steps.build.outputs.ZIP_FOLDER }}/*.zip*
144+ ${{ steps.attest.outputs.bundle-path }}
132145 fail_on_unmatched_files : true
133146 - name : " Upload artifacts"
134147 uses : actions/upload-artifact@v4
@@ -140,13 +153,15 @@ jobs:
140153 retention-days : 10
141154 compression-level : 0
142155
143- keep-cache :
144- name : " Keep cache alive"
156+ keep-alive :
157+ name : " Keep alive"
145158 runs-on : ubuntu-latest
146159 if : " ${{ github.event_name == 'schedule' }}"
160+ permissions :
161+ actions : write # Needed to keep alive the workflow
147162
148163 steps :
149- - name : " Checkout sources "
164+ - name : " Checkout file "
150165 uses : actions/checkout@v4
151166 with :
152167 sparse-checkout : |
@@ -159,3 +174,24 @@ jobs:
159174 path : " cache/build"
160175 enableCrossOsArchive : true
161176 lookup-only : true
177+ - name : " Keep workflow alive"
178+ uses : actions/github-script@v7
179+ env :
180+ WORKFLOW_REF : " ${{ github.workflow_ref }}"
181+ with :
182+ retries : 3
183+ script : |
184+ /* jshint esversion: 6 */
185+ const workflow_filename = process.env.WORKFLOW_REF.split('@', 1)[0].split('/').slice(2).join('/');
186+ const response = await github.rest.actions.enableWorkflow({
187+ owner: context.repo.owner,
188+ repo: context.repo.repo,
189+ workflow_id: workflow_filename
190+ }).catch(response => response);
191+ if(response && response.status === 204) {
192+ // OK
193+ } else {
194+ let errorMsg = 'enableWorkflow failed';
195+ if(response && response.status && response.message) errorMsg += ' with error ' + response.status + ' (' + response.message + ')';
196+ throw new Error(errorMsg);
197+ }
0 commit comments