Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
459aa511aThis 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/simulator/**'
- '.github/actions/setup/action.yml'
- '.github/workflows/bundle.yml'
pull_request:
branches:
- develop
paths:
- 'firmware/**'
- 'web/simulator/**'
- '.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:
install-emscripten: "true"
- name: Bundle firmware
working-directory: ./firmware
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run bundle
- 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: 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
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 ./web/flash/tech.moddable.stackchan ./web/simulator
if git diff --cached --quiet; then
echo "No bundle changes to deploy"
exit 0
fi
git commit -m "Deploy firmware bundle from ${{ github.sha }}"
git push origin HEAD:gh-pages