feat: add fullClean method for complete display refresh and update Ap… #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "v*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/platformio.ini') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }} | |
| restore-keys: | | |
| ${{ runner.os }}-platformio- | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install PlatformIO | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install platformio | |
| - name: Build Firmware | |
| run: | | |
| # Use tag as version if available, else 'dev' | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| else | |
| VERSION="0.0.1-dev" | |
| fi | |
| echo "Building version $VERSION" | |
| # Inject version into build | |
| PLATFORMIO_BUILD_FLAGS="-DAPP_VERSION=\\\"$VERSION\\\"" platformio run | |
| - name: Prepare Web Flasher | |
| run: | | |
| mkdir -p web_flasher | |
| # Copy artifacts | |
| cp .pio/build/t-deck-pro/firmware.bin web_flasher/ | |
| cp .pio/build/t-deck-pro/partitions.bin web_flasher/ | |
| cp .pio/build/t-deck-pro/bootloader.bin web_flasher/ | |
| # Create version.txt for legacy check (optional) | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| else | |
| VERSION="0.0.1-dev" | |
| fi | |
| echo "$VERSION" > web_flasher/firmware.txt | |
| # Generate/Update Manifest for OTA | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| # We assume the script is committed or we create it here. | |
| # Ideally committed. We used create_file tool so it should be in the repo if committed. | |
| # But CI checks out code. So we need to ensure the script exists in the checkout. | |
| # Assuming user commits the scripts/ folder. | |
| python3 scripts/update_manifest.py "${{ github.repository }}" "$VERSION" | |
| else | |
| # For dev builds, make a basic manifest pointing to this build's artifact? | |
| # Or just skip. Let's make a dev manifest. | |
| # On dev, URL is relative or we don't support full OTA selection from dev builds easily without releases. | |
| echo '{"name":"SshDeck Dev","latest":"'$VERSION'","versions":[]}' > web_flasher/firmware.json | |
| fi | |
| # Update manifest.json version for Web Flasher (ESP Web Tools) | |
| jq --arg v "$VERSION" '.version = $v' web_flasher/manifest.json > web_flasher/manifest.json.tmp && mv web_flasher/manifest.json.tmp web_flasher/manifest.json | |
| # Disable Jekyll integration ensures unwanted file filtering doesn't happen | |
| touch web_flasher/.nojekyll | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| web_flasher/firmware.bin | |
| web_flasher/partitions.bin | |
| web_flasher/bootloader.bin | |
| generate_release_notes: true | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firmware | |
| path: web_flasher/ | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: firmware | |
| path: . | |
| - name: Fix content structure | |
| run: | | |
| if [ -d "web_flasher" ]; then | |
| echo "Moving content from web_flasher to root..." | |
| cp -r web_flasher/* . | |
| rm -rf web_flasher | |
| fi | |
| ls -R | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |