Skip to content

Merge pull request #15 from clarkehackworth/main #15

Merge pull request #15 from clarkehackworth/main

Merge pull request #15 from clarkehackworth/main #15

Workflow file for this run

name: Build on Tag
on:
push:
tags:
- "v*" # Triggers on tags like v1.0.0, v2.1.3, etc.
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Get version from tag
id: get_version
run: |
# Remove 'v' prefix if present and get version
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Build web assets
run: |
cd web
npm install
npm run build
- name: Build firmware for ESP32
run: |
export FIRMWARE_VERSION="${{ steps.get_version.outputs.version }}"
export CHIP_FAMILY="ESP32"
pio run -e esp32-build
# Create artifacts directory and copy ESP32 firmware immediately
mkdir -p artifacts
cp .pio/build/esp32-build/firmware_merged.bin artifacts/esp32-${{ steps.get_version.outputs.version }}-full.bin
cp .pio/build/esp32-build/firmware.bin artifacts/esp32-${{ steps.get_version.outputs.version }}-firmware-only.bin
- name: Build firmware for ESP32-S3
run: |
export FIRMWARE_VERSION="${{ steps.get_version.outputs.version }}"
export CHIP_FAMILY="ESP32-S3"
pio run -e esp32-s3-build
# Copy ESP32-S3 firmware immediately after build
cp .pio/build/esp32-s3-build/firmware_merged.bin artifacts/esp32s3-${{ steps.get_version.outputs.version }}-full.bin
cp .pio/build/esp32-s3-build/firmware.bin artifacts/esp32s3-${{ steps.get_version.outputs.version }}-firmware-only.bin
- name: Create release artifacts
run: |
# Create manifest.json for ESP Web Tools
cat > artifacts/manifest.json << 'EOF'
{
"name": "ESP SFS",
"version": "${{ steps.get_version.outputs.version }}",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32",
"parts": [
{ "path": "esp32-${{ steps.get_version.outputs.version }}-full.bin", "offset": 0 }
]
},
{
"chipFamily": "ESP32-S3",
"parts": [
{ "path": "esp32s3-${{ steps.get_version.outputs.version }}-full.bin", "offset": 0 }
]
}
]
}
EOF
- name: Create GitHub Pages site
run: |
mkdir -p pages
# Copy artifacts to pages directory
cp artifacts/* pages/
# Create index.html for ESP Web Tools
cat > pages/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESP SFS Firmware Installer - v${{ steps.get_version.outputs.version }}</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
background: #f5f5f5;
}
.container {
background: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #333;
text-align: center;
margin-bottom: 2rem;
}
.version-info {
background: #f8f9fa;
padding: 1rem;
border-radius: 4px;
margin-bottom: 2rem;
}
.install-section {
text-align: center;
margin: 2rem 0;
}
.note {
color: #666;
font-size: 0.9rem;
margin-top: 1rem;
}
esp-web-install-button {
display: inline-block;
margin: 1rem;
}
</style>
</head>
<body>
<div class="container">
<h1>Esp -> Elegoo Carbon Centauri X BigTreeTech SFS Firmware Installer</h1>
<div class="version-info">
<h3>Version: ${{ steps.get_version.outputs.version }}</h3>
</div>
<div class="install-section">
<h2>Install Firmware</h2>
<p>Connect your ESP device via USB and click the install button below:</p>
<esp-web-install-button
manifest="manifest.json"
></esp-web-install-button>
<div class="note">
<p><strong>Requirements:</strong></p>
<ul style="text-align: left; display: inline-block;">
<li>Chrome, Edge, or other Chromium-based browser</li>
<li>ESP32 or ESP32-S3 device connected via USB</li>
<li>USB drivers installed for your device</li>
</ul>
</div>
</div>
</div>
<script
type="module"
src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"
></script>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-${{ steps.get_version.outputs.version }}
path: artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}