name: 'Build dev release' on: workflow_dispatch: push: paths: - 'src/emsesp_version.h' branches: - 'dev' permissions: contents: write jobs: pre-release: name: 'Build Dev Release' if: github.event_name == 'workflow_dispatch' || github.repository == 'emsesp/EMS-ESP32' runs-on: ubuntu-latest steps: - name: Install python 3.13 uses: actions/setup-python@v7 with: python-version: '3.13' - name: Install Node.js 26 uses: actions/setup-node@v7 with: node-version: 26 - name: Checkout repository uses: actions/checkout@v7 with: fetch-depth: 0 - name: Install pnpm run: npm install -g pnpm - name: Get the EMS-ESP version id: build_info run: | version=`grep -E '^#define EMSESP_APP_VERSION' ./src/emsesp_version.h | awk -F'"' '{print $2}'` echo "VERSION=$version" >> $GITHUB_OUTPUT # must run before the release moves the 'latest' tag to this build - name: Find the previous dev release id: previous run: | prev=`git rev-parse -q --verify 'refs/tags/latest^{commit}' || git describe --tags --abbrev=0 --match 'v*'` echo "REF=$prev" >> $GITHUB_OUTPUT - name: Install PlatformIO run: | python -m pip install --upgrade pip pip install -U platformio python -m pip install intelhex - name: Build webUI run: | platformio run -e build-webUI - name: Build modbus run: | platformio run -e build_modbus - name: Build standalone run: | platformio run -e build_standalone - name: Build all PIO target environments, from default_envs run: | platformio run - name: Commit the generated files uses: stefanzweifel/git-auto-commit-action@v7 with: commit_message: "chore: update generated files for v${{steps.build_info.outputs.VERSION}}" # an empty body falls back to the commit list generated by the release action - name: Build the release notes id: notes env: PREV_REF: ${{ steps.previous.outputs.REF }} VERSION: ${{ steps.build_info.outputs.VERSION }} run: | ./scripts/release_notes.sh "$PREV_REF" "$VERSION" > release_notes.md || : cat release_notes.md { echo 'BODY<<__RELEASE_NOTES_EOF__' cat release_notes.md echo '__RELEASE_NOTES_EOF__' } >> $GITHUB_OUTPUT - name: Create GitHub Release id: 'automatic_releases' uses: emsesp/action-automatic-releases@v1.0.1 with: repo_token: '${{ secrets.GITHUB_TOKEN }}' title: Development Build v${{steps.build_info.outputs.VERSION}} body: ${{ steps.notes.outputs.BODY }} automatic_release_tag: 'latest' prerelease: true files: | CHANGELOG_LATEST.md ./build/firmware/*.* - name: Update version in Cloudflare KV store if: github.repository == 'emsesp/EMS-ESP32' env: CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} CF_NAMESPACE_ID: ${{ secrets.CF_NAMESPACE_ID }} CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} VERSION: ${{ steps.build_info.outputs.VERSION }} run: | JSON_DATA=$(jq -n \ --arg version "$VERSION" \ --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ '{version: $version, date: $date}') echo "JSON_DATA: $JSON_DATA" curl -sS --fail-with-body \ -X PUT "https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/storage/kv/namespaces/${CF_NAMESPACE_ID}/values/dev" \ -H "Authorization: Bearer ${CF_API_TOKEN}" \ -H "Content-Type: application/json" \ -d "$JSON_DATA" echo