Deploy CI JSON to GitHub Pages #301
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Arduino s.r.l. and/or its affiliated companies | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # CI workflow to upload the zephyr_ci package index to GitHub Pages. | |
| name: Deploy CI JSON to GitHub Pages | |
| on: | |
| workflow_run: | |
| workflows: ["Package, test and upload core"] | |
| types: | |
| - completed | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| submit-json-to-gh-pages: | |
| name: Update git JSON on Github Pages | |
| runs-on: ubuntu-latest | |
| if: ${{ github.repository == 'arduino/ArduinoCore-zephyr' | |
| && github.event.workflow_run.event == 'push' | |
| && github.event.workflow_run.head_branch == 'main' | |
| && github.event.workflow_run.conclusion == 'success' }} | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }}/package_zephyr_ci_index.json | |
| steps: | |
| - name: Download artifact | |
| id: download-artifact | |
| uses: dawidd6/action-download-artifact@v20 | |
| with: | |
| workflow: package-core.yml | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: ArduinoCore-zephyr-.*-jsons | |
| name_is_regexp: true | |
| - name: Setup private SSH key | |
| uses: webfactory/ssh-agent@v0.10.0 | |
| with: | |
| ssh-private-key: ${{ secrets.PACKAGE_INDEX_DEPLOY_KEY }} | |
| - name: Create zephyr_ci package index | |
| run: | | |
| git clone ${{ secrets.PACKAGE_INDEX_REPO }} package_index | |
| mkdir -p package_index/zephyr_ci/arduino/platforms pages | |
| cd package_index | |
| cp ../ArduinoCore-*/*.json zephyr_ci/arduino/platforms/ | |
| (cd zephyr_staging && for dir in */tools ; do mkdir -p ../zephyr_ci/$dir && cp $dir/*.json ../zephyr_ci/$dir/ ; done) | |
| python3 -m venv venv | |
| . venv/bin/activate | |
| pip install -r scripts/requirements.txt | |
| scripts/meld.py prod.json prod/ | |
| scripts/meld.py --ref-index prod.json ../pages/package_zephyr_ci_index.json zephyr_ci/ | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: 'pages/' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |