Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
f1c988c28This file is pinned to the selected release. Download the original to open it in your design tool.
name: Bundle Stack-chan Firmware
on:
push:
branches:
- develop
paths:
- "firmware/**"
- "web/**"
- ".github/actions/setup/action.yml"
- ".github/workflows/bundle.yml"
pull_request:
branches:
- develop
paths:
- "firmware/**"
- "web/**"
- ".github/actions/setup/action.yml"
- ".github/workflows/bundle.yml"
permissions:
contents: read
concurrency:
group: bundle-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup
uses: ./.github/actions/setup
with:
target-branch: "8.3.1"
install-emscripten: "true"
- name: Install web test dependencies
working-directory: ./firmware
run: npm --prefix ../web ci
- name: Rebuild editor tools for release verification
working-directory: ./firmware
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run build:editor-tools
- name: Verify release editor tools
working-directory: ./firmware
run: |
npm --prefix ../web run check:editor-artifacts
git diff --exit-code -- ':(top)web/editor/vendor/tools.js' ':(top)web/editor/vendor/tools.wasm'
- name: Bundle firmware
working-directory: ./firmware
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run bundle
- name: Verify M5StackChan CoreS3 bundle target
working-directory: ./firmware
run: |
target="host/app/tech.moddable.stackchan/m5stackchan_cores3"
for binary in bootloader.bin partition-table.bin xs_esp32.bin; do
test -s "$target/$binary"
done
- name: Build WASM simulator firmware
working-directory: ./firmware
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run build:wasm
- name: Upload firmware bundle
uses: actions/upload-artifact@v7
with:
name: firmware-bundle
path: ./firmware/host/app/tech.moddable.stackchan
- name: Upload WASM simulator
uses: actions/upload-artifact@v7
with:
name: wasm-simulator
path: ./web/simulator
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
permissions:
contents: write
steps:
- name: Checkout Pages branch
uses: actions/checkout@v7
with:
ref: gh-pages
- name: Checkout website source
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
path: website-source
persist-credentials: false
- name: Download firmware bundle
uses: actions/download-artifact@v8
with:
name: firmware-bundle
path: ./firmware-bundle
- name: Download WASM simulator
uses: actions/download-artifact@v8
with:
name: wasm-simulator
path: ./wasm-simulator
- name: Update bundle files
run: |
if [ -z "$(find ./firmware-bundle -mindepth 1 -print -quit)" ]; then
echo "Firmware bundle artifact is empty"
exit 1
fi
if [ -z "$(find ./wasm-simulator -mindepth 1 -print -quit)" ]; then
echo "WASM simulator artifact is empty"
exit 1
fi
rsync -a --delete \
--exclude '/schematics/' \
--exclude '/flash/tech.moddable.stackchan/' \
--exclude '/simulator/' \
./website-source/web/ ./web/
rm -rf ./web/flash/tech.moddable.stackchan ./web/simulator
mkdir -p ./web/flash/tech.moddable.stackchan ./web/simulator
cp -R ./firmware-bundle/. ./web/flash/tech.moddable.stackchan/
cp -R ./wasm-simulator/. ./web/simulator/
- name: Commit bundle update
run: |
git config user.name 'GitHub Action'
git config user.email 'action@github.com'
git add --all ./web
if git diff --cached --quiet; then
echo "No bundle changes to deploy"
exit 0
fi
git commit -m "Deploy website and firmware bundle from ${{ github.sha }}"
git push origin HEAD:gh-pages