fix(ci): remove invalid clean_ignore: [] YAML in release3.yml causing… #181
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: Beta Release V3.0 | |
| # Create a beta: commit with message "Beta v<major>.<minor>.<patch>" | |
| # Manifests are deployed to GitHub Pages (melkati.github.io/CO2-Gadget/beta/) | |
| # Firmware .bin files are deployed via FTP to emariete.com | |
| # | |
| # Architecture: | |
| # build_beta (matrix, parallel) → uploads artifacts | |
| # deploy (single job, after all builds) → gh-pages (manifests) + FTP (.bin files) | |
| on: | |
| push: | |
| branches: | |
| - development | |
| paths-ignore: | |
| - '.github/workflows/release3_beta.yml' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version number (e.g. 0.16.012)' | |
| required: false | |
| default: '0.0.0' | |
| jobs: | |
| build_beta: | |
| # Only run when commit message contains "Beta" and does not contain "low-power", | |
| # or when triggered manually via workflow_dispatch. | |
| if: contains(github.event.head_commit.message, 'Beta') && !contains(github.event.head_commit.message, 'low-power') || github.event_name == 'workflow_dispatch' | |
| name: Build ${{ matrix.environment }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| environment: | |
| - esp32dev | |
| - esp32dev_OLED | |
| - TTGO_TDISPLAY | |
| - TTGO_TDISPLAY_SANDWICH | |
| - TDISPLAY_S3 | |
| - esp32dev_ST7789_240x320 | |
| - ttgo-t5-EINKBOARDGDEM0213B74 | |
| - ttgo-t5-EINKBOARDDEPG0213BN | |
| - ttgo-t5-EINKBOARDGDEW0213M21 | |
| - ttgo-t7-EINKBOARDGDEM029T94 | |
| - ttgo-t7-WEACT_GDEH0154D67 | |
| - ttgo-t7-WEACT_DEPG0213BN | |
| - ttgo-t7-WEACT_GxEPD2_290_BS | |
| env: | |
| CHIP_FAMILY: ${{ matrix.environment == 'TDISPLAY_S3' && 'ESP32-S3' || 'ESP32' }} | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check if version exists | |
| id: check_version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| # Manual trigger: version must be provided as input (defaults to "0.0.0") | |
| VERSION="${{ github.event.inputs.version || '0.0.0' }}" | |
| echo "Manual trigger — using version: $VERSION" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| # Push trigger: extract version from commit message | |
| commit_message=$(git log --format=%B -n 1 $GITHUB_SHA) | |
| version_regex="Beta v([0-9]+\.[0-9]+\.[0-9]+)" | |
| if [[ $commit_message =~ $version_regex ]]; then | |
| echo "Version found: ${BASH_REMATCH[1]}" | |
| echo "VERSION=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT | |
| else | |
| echo "No valid version found in commit message. Exiting..." | |
| exit 1 | |
| fi | |
| fi | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.platformio | |
| .pio/build | |
| key: pio-${{ matrix.environment }}-${{ hashFiles('platformio.ini') }} | |
| restore-keys: | | |
| pio-${{ matrix.environment }}- | |
| pio- | |
| - name: Install dependencies | |
| if: steps.check_version.outputs.VERSION != '' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -U platformio | |
| platformio update | |
| - name: Get current date | |
| if: steps.check_version.outputs.VERSION != '' | |
| id: date | |
| run: | | |
| echo "date=$(date +'%d-%m-%Y')" >> $GITHUB_OUTPUT | |
| echo "time=$(date +'%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - name: Build firmware | |
| if: steps.check_version.outputs.VERSION != '' | |
| run: | | |
| pio run -e ${{ matrix.environment }} | |
| - name: Build filesystem | |
| if: steps.check_version.outputs.VERSION != '' | |
| run: | | |
| pio run -e ${{ matrix.environment }} -t buildfs | |
| - name: Create manifest with absolute .bin URLs | |
| if: steps.check_version.outputs.VERSION != '' | |
| id: create_manifest | |
| env: | |
| VERSION: ${{ steps.check_version.outputs.VERSION }} | |
| COMPILED_DATE: ${{ steps.date.outputs.date }} | |
| COMPILED_TIME: ${{ steps.date.outputs.time }} | |
| run: | | |
| # SPIFFS offset differs for ESP32-S3 | |
| if [[ "${{ env.CHIP_FAMILY }}" == "ESP32-S3" ]]; then | |
| bootloader_offset=0 | |
| partitions_offset=32768 | |
| firmware_offset=65536 | |
| spiffs_offset=13172736 | |
| else | |
| bootloader_offset=4096 | |
| partitions_offset=32768 | |
| firmware_offset=65536 | |
| spiffs_offset=3604480 | |
| fi | |
| # Base URL for .bin files on emariete.com (absolute paths in manifest) | |
| BIN_BASE_URL="https://emariete.com/wp-content/uploads/firmware/CO2-Gadget/beta" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| ENV_NAME="${{ matrix.environment }}" | |
| VER="${{ steps.check_version.outputs.VERSION }}" | |
| cat > ${REPO_NAME}-${ENV_NAME}.beta.manifest.json << EOF | |
| { | |
| "name": "${REPO_NAME}-${ENV_NAME}", | |
| "flavour": "${ENV_NAME}", | |
| "version": "${VER}-beta", | |
| "compilation_date": "${COMPILED_DATE}", | |
| "compilation_time": "${COMPILED_TIME}", | |
| "new_install_prompt_erase": true, | |
| "new_install_improv_wait_time": 20, | |
| "builds": [ | |
| { | |
| "chipFamily": "${{ env.CHIP_FAMILY }}", | |
| "improv": true, | |
| "parts": [ | |
| { "path": "${BIN_BASE_URL}/${REPO_NAME}-${ENV_NAME}-${VER}-bootloader.bin", "offset": ${bootloader_offset} }, | |
| { "path": "${BIN_BASE_URL}/${REPO_NAME}-${ENV_NAME}-${VER}-partitions.bin", "offset": ${partitions_offset} }, | |
| { "path": "${BIN_BASE_URL}/${REPO_NAME}-${ENV_NAME}-${VER}-firmware.bin", "offset": ${firmware_offset} }, | |
| { "path": "${BIN_BASE_URL}/${REPO_NAME}-${ENV_NAME}-${VER}-spiffs.bin", "offset": ${spiffs_offset} } | |
| ] | |
| } | |
| ] | |
| } | |
| EOF | |
| - name: Upload artifact (all files for this environment) | |
| if: steps.check_version.outputs.VERSION != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: beta-${{ matrix.environment }} | |
| path: | | |
| .pio/build/${{ matrix.environment }}/bootloader.bin | |
| .pio/build/${{ matrix.environment }}/partitions.bin | |
| .pio/build/${{ matrix.environment }}/firmware.bin | |
| .pio/build/${{ matrix.environment }}/spiffs.bin | |
| ${{ github.event.repository.name }}-${{ matrix.environment }}.beta.manifest.json | |
| retention-days: 2 | |
| deploy: | |
| name: Deploy Beta Release | |
| needs: build_beta | |
| runs-on: ubuntu-latest | |
| # Only run if at least one build succeeded (not skipped, not failed) | |
| if: needs.build_beta.result == 'success' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./beta_firmware | |
| pattern: beta-* | |
| merge-multiple: false | |
| - name: List downloaded files | |
| run: | | |
| echo "=== Downloaded files ===" | |
| find ./beta_firmware -type f | sort | |
| - name: Extract version from any artifact name | |
| id: get_version | |
| run: | | |
| # Find any manifest to extract version | |
| MANIFEST=$(find ./beta_firmware -name "*.manifest.json" | head -1) | |
| if [ -n "$MANIFEST" ]; then | |
| VERSION=$(grep -oP '"version":\s*"\K[^"]+' "$MANIFEST" | sed 's/-beta//') | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Found version: $VERSION" | |
| fi | |
| - name: Organize files for GitHub Pages (manifests only) | |
| run: | | |
| # Put manifests inside ./gh-pages/beta/ so they end up at /beta/<manifest> | |
| mkdir -p ./gh-pages/beta | |
| find ./beta_firmware -name "*.manifest.json" -exec cp {} ./gh-pages/beta/ \; | |
| echo "=== Manifests for GitHub Pages ===" | |
| ls -laR ./gh-pages/beta/ | |
| - name: Organize files for FTP (.bin only) | |
| run: | | |
| mkdir -p ./ftp_firmware/beta | |
| find ./beta_firmware -name "*.bin" -exec cp {} ./ftp_firmware/beta/ \; | |
| echo "=== Firmware for FTP ===" | |
| ls -la ./ftp_firmware/beta/ | |
| # ------------------------------------------------------------------ | |
| # STEP 1: Deploy manifests to GitHub Pages | |
| # publish_dir=./gh-pages publishes its CONTENTS to gh-pages root | |
| # So ./gh-pages/beta/<files> → gh-pages/beta/<files> | |
| # URL: melkati.github.io/CO2-Gadget/beta/<manifest> | |
| # ------------------------------------------------------------------ | |
| - name: Deploy manifests to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./gh-pages | |
| force_orphan: true | |
| commit_message: "Beta v${{ steps.get_version.outputs.VERSION }} manifests" | |
| # ------------------------------------------------------------------ | |
| # STEP 2: Deploy .bin files to emariete.com via FTP | |
| # ------------------------------------------------------------------ | |
| - name: FTP upload firmware .bin files | |
| uses: SamKirkland/FTP-Deploy-Action@2.0.0 | |
| env: | |
| FTP_SERVER: ${{ secrets.FTP_SERVER }} | |
| FTP_USERNAME: ${{ secrets.FTP_USER }} | |
| FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
| LOCAL_DIR: ./ftp_firmware/beta/ | |
| REMOTE_DIR: /${{ github.event.repository.name }}/beta/ | |
| METHOD: ftp | |
| PORT: 21 | |
| ARGS: --verbose | |
| - name: Purge origin cache (LiteSpeed) | |
| run: | | |
| curl -sf "https://emariete.com/clean_cache_litespeed.php" || true | |
| echo "Origin cache purge attempted" |