Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: Borneo Firmware Release CI
on:
pull_request:
branches: [master]
paths:
- 'fw/**'
- '.github/workflows/fw-release.yml'
workflow_dispatch:
schedule:
- cron: '0 18 * * *'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
LYFI_PRODUCTS: bst/ulva6 bst/blc06mk1 bst/xiaoc3 bst/c3devkitm1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build LyFi Firmware in Docker
run: |
mkdir artifacts
for product in ${{ env.LYFI_PRODUCTS }}; do
docker run -t \
-v "${GITHUB_WORKSPACE}:/app/${{ github.repository }}" \
-w "/app/${{ github.repository }}/fw/lyfi" \
espressif/idf:v5.5 \
/bin/bash -c "rm -rf build && git config --global --add safe.directory '*' && idf.py build -DPRODUCT_ID=$product -DCMAKE_BUILD_TYPE=Release && idf.py merge-bin"
python fw/scripts/ci/generate_firmware_manifest.py fw/lyfi -o artifacts
done
- name: Generate Manifests file
run: python fw/scripts/ci/merge_manifest.py ./artifacts -o ./artifacts/manifests.json
- name: Create and push new tag
run: |
git tag -d release-fw-latest || true
git tag release-fw-latest
git push origin release-fw-latest --force
- name: Remove previous release assets
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const tag = 'release-fw-latest';
try {
const rel = await github.rest.repos.getReleaseByTag({ owner: context.repo.owner, repo: context.repo.repo, tag });
const release_id = rel.data.id;
const assets = await github.paginate(github.rest.repos.listReleaseAssets, { owner: context.repo.owner, repo: context.repo.repo, release_id });
for (const a of assets) {
console.log(`Deleting asset ${a.name} (${a.id})`);
await github.rest.repos.deleteReleaseAsset({ owner: context.repo.owner, repo: context.repo.repo, asset_id: a.id });
}
console.log('Previous release assets removed.');
} catch (err) {
if (err.status === 404) {
console.log('Release not found, nothing to delete.');
} else {
throw err;
}
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: release-fw-latest
name: Daily Firmware Release
draft: false
overwrite_files: true
files: artifacts/*
- name: Trigger web-flasher workflow
uses: actions/github-script@v8
with:
github-token: ${{ secrets.BORNEO_OSS_WEB_FLASHER_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({
owner: 'borneo-iot',
repo: 'web-flasher',
event_type: 'deploy-firmware',
client_payload: {}
});
99de892bbThis file is pinned to the selected release. Download the original to open it in your design tool.