@@ -604,3 +604,66 @@ jobs:
604604 with :
605605 name : ArduinoCore-zephyr-${{ env.CORE_TAG }}-jsons
606606 path : ArduinoCore-*-${{ env.CORE_TAG }}.json
607+
608+ ci-builds-upload :
609+ runs-on : ubuntu-latest
610+ needs :
611+ - build-env
612+ - verify-core
613+ - prepare-json
614+ permissions :
615+ id-token : write # required to obtain the OIDC token
616+ env :
617+ CORE_TAG : ${{ needs.build-env.outputs.CORE_TAG }}
618+ CORE_VER : ${{ needs.build-env.outputs.CORE_VER }}
619+ steps :
620+ - uses : actions/download-artifact@v8
621+ with :
622+ path : jsons/
623+ name : ArduinoCore-zephyr-${{ env.CORE_TAG }}-jsons
624+
625+ - uses : actions/download-artifact@v8
626+ with :
627+ path : .
628+ name : build-metadata
629+
630+ - run : |
631+ find
632+ echo "SNIPPETS<<EOF" >> $GITHUB_ENV
633+ jq -n 'reduce inputs as $i ({}; .[input_filename] = $i)' ArduinoCore-*.json >> $GITHUB_ENV
634+ echo "EOF" >> $GITHUB_ENV
635+ echo "METADATA<<EOF" >> $GITHUB_ENV
636+ jq -c '{"${{ env.CORE_VER }}": .}' ${CORE_VER}.json >> $GITHUB_ENV
637+ echo "EOF" >> $GITHUB_ENV
638+
639+ - name : Get OIDC identity token
640+ id : oidc
641+ uses : actions/github-script@v7
642+ with :
643+ script : |
644+ const token = await core.getIDToken('arduino/ci-builds');
645+ core.setOutput('token', token)
646+
647+ - name : Store snippets in ci-builds
648+ uses : actions/github-script@v7
649+ with :
650+ github-token : ${{ secrets.CI_BUILDS_TOKEN }}
651+ script : |
652+ await github.rest.actions.createWorkflowDispatch({
653+ owner: 'pillo79',
654+ repo: 'ci-builds',
655+ workflow_id: 'store-snippets.yml',
656+ ref: 'main',
657+ inputs: {
658+ oidc_token: '${{ steps.oidc.outputs.token }}',
659+ // Required only when running from a tag ref; ignored for branch refs.
660+ // Snippets will be stored under this branch's folder.
661+ base_branch: '${{ needs.build-env.outputs.CORE_BRANCH }}',
662+ // 'platform' (default) or 'tool'
663+ snippet_type: 'platform',
664+ // build version — required when passing metadata
665+ version: '${{ env.CORE_VER }}',
666+ snippets: '${{ env.SNIPPETS }}',
667+ metadata: '${{ env.METADATA }}',
668+ },
669+ });
0 commit comments