Skip to content

feature: Command Line input buffer (#86) #191

feature: Command Line input buffer (#86)

feature: Command Line input buffer (#86) #191

Workflow file for this run

name: Build and upload
on:
push:
branches:
- main
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # required to use OIDC
steps:
- uses: actions/checkout@v6
- name: Remove old files and folders
run: |
rm -rf package-lock.json
rm -rf dist
rm -rf js/modules
mkdir js/modules
- name: install node v25
uses: actions/setup-node@v6
with:
node-version: 25.4.0
registry-url: 'https://registry.npmjs.org'
- name: Update npm to latest
run: npm install -g npm@latest
- name: Check npm version
run: npm --version
- name: Install NPM
run: npm install
- name: Compile TypeScript
run: |
set -e
rm -rf dist
NODE_ENV=production npm exec -- tsc
NODE_ENV=production npm exec -- rollup -c
- name: Rename and copy build artifact
run: |
cp dist/web/*.js js/modules/
mv js/modules/index.js js/modules/esptool.js
#ls js/modules/
- name: Generate PWA Icons
run: |
# Check if ImageMagick is available
if command -v convert &> /dev/null; then
echo "ImageMagick found, generating icons..."
chmod +x generate-icons.sh
./generate-icons.sh
else
echo "ImageMagick not found, installing..."
sudo apt-get update
sudo apt-get install -y imagemagick
chmod +x generate-icons.sh
./generate-icons.sh
fi
- name: Validate PWA Files
run: |
echo "Checking PWA files..."
if [ ! -f "manifest.json" ]; then
echo "Error: manifest.json not found!"
exit 1
fi
if [ ! -f "sw.js" ]; then
echo "Error: sw.js not found!"
exit 1
fi
if [ ! -d "icons" ]; then
echo "Error: icons directory not found!"
exit 1
fi
echo "PWA files validated successfully!"
echo "Icon files:"
ls -lh icons/
- name: Commit Distribution Files
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Github Action: Updated dist files and PWA assets"
file_pattern: "js/modules/*.js icons/*.png screenshots/*.png manifest.json sw.js favicon.ico apple-touch-icon.png"
- name: Publish to NPM registry (OIDC Trusted Publishing)
uses: JS-DevTools/npm-publish@v4
with:
registry: https://registry.npmjs.org/
strategy: all
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Create deployment directory
run: |
mkdir -p _site
# Copy all necessary files for PWA deployment
cp -r css _site/
cp -r js _site/
cp -r src _site/
cp -r icons _site/
cp -r screenshots _site/ 2>/dev/null || echo "No screenshots directory"
cp -r electron _site/ 2>/dev/null || echo "No electron directory needed for web"
cp index.html _site/
cp manifest.json _site/
cp sw.js _site/
cp install-android.html _site/
cp favicon.ico _site/ 2>/dev/null || echo "No favicon.ico"
cp apple-touch-icon.png _site/ 2>/dev/null || echo "No apple-touch-icon.png"
cp .nojekyll _site/
cp README.md _site/ 2>/dev/null || echo "No README needed for deployment"
echo "Deployment directory contents:"
ls -la _site/
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: "_site"
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5