Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
8d988c917This 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
paths:
- 'firmware/**'
- '.github/actions/setup/action.yml'
- '.github/workflows/bundle.yml'
pull_request:
branches:
- dev/v1.0
paths:
- 'firmware/**'
- '.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@v4
- name: Setup
uses: ./.github/actions/setup
- name: Bundle firmware
working-directory: ./firmware
run: source "$HOME/.local/share/xs-dev-export.sh" && npm run bundle
- name: Upload firmware bundle
uses: actions/upload-artifact@v4
with:
name: firmware-bundle
path: ./firmware/stackchan/tech.moddable.stackchan
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/dev/v1.0'
runs-on: ubuntu-latest
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
permissions:
contents: write
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: Update bundle files
run: |
if [ -z "$(find ./firmware-bundle -mindepth 1 -print -quit)" ]; then
echo "Firmware bundle artifact is empty"
exit 1
fi
rm -rf ./web/flash/tech.moddable.stackchan
mkdir -p ./web/flash/tech.moddable.stackchan
cp -R ./firmware-bundle/. ./web/flash/tech.moddable.stackchan/
- 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
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