Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
adfe118f0This 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:
- dev/v1.0
pull_request:
branches:
- dev/v1.0
# Allow the stacked PR that targets the WASM build-support branch to run.
- feat/wasm-stackchan-build
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for changes in firmware
id: diff_check
run: |
git diff --quiet HEAD^ HEAD -- ./firmware/ || echo "diff_detected=true" >> $GITHUB_ENV
- name: Cache build results
id: cache
uses: actions/cache@v4
with:
path: ./firmware/stackchan/tech.moddable.stackchan
key: ${{ github.sha }}
- name: Setup
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup
- name: Pin Moddable SDK
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
run: |
git -C "$HOME/.local/share/moddable" fetch origin b0411457e4577ea5560c780cb7824f3b00c2b2af
git -C "$HOME/.local/share/moddable" checkout b0411457e4577ea5560c780cb7824f3b00c2b2af
- name: Bundle
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run bundle
working-directory: ./firmware
- name: Setup Emscripten for WASM simulator
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.2
- name: Build WASM simulator firmware
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run build:wasm
working-directory: ./firmware
- name: Upload Firmware Bundle
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: firmware-bundle
path: ./firmware/stackchan/tech.moddable.stackchan
- name: Upload WASM Simulator
if: ${{ env.diff_detected}} || steps.cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: wasm-simulator
path: ./web/simulator
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/dev/v1.0'
runs-on: ubuntu-latest
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Download Firmware Bundle
uses: actions/download-artifact@v4
with:
name: firmware-bundle
path: ./firmware-bundle
- name: Download WASM Simulator
uses: actions/download-artifact@v4
with:
name: wasm-simulator
path: ./wasm-simulator
- name: Move Bundle
run: |
mkdir -p ./web/flash/tech.moddable.stackchan
rm -rf ./web/flash/tech.moddable.stackchan/*
mv firmware-bundle/* ./web/flash/tech.moddable.stackchan
- name: Move WASM Simulator
run: |
mkdir -p ./web/simulator
rm -rf ./web/simulator/*
mv wasm-simulator/* ./web/simulator
- name: Commit and Push
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add .
git commit -m "Deploy firmware bundle from ${{ github.sha }}"
git push