diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b02fab4..e741dfb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,11 @@ name: PlatformIO CI # Only included into other workflows on: workflow_call: + inputs: + version: + description: 'Build VERSION in format yymmddb (optional, for nightly builds)' + required: false + type: string jobs: @@ -62,6 +67,7 @@ jobs: - name: Build firmware env: WLED_RELEASE: True + PLATFORMIO_BUILD_FLAGS: ${{ inputs.version && format('-D VERSION={0}', inputs.version) || '' }} run: pio run -e ${{ matrix.environment }} - name: Rename Bin run: mv -v .pio/build/${{ matrix.environment }}/firmware.bin firmware-${{ matrix.environment }}.bin diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d64b7f13..88b70d11 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -8,8 +8,25 @@ on: workflow_dispatch: jobs: + calculate_version: + name: Calculate VERSION + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Calculate VERSION + id: version + run: | + # VERSION format: yymmddb (b = daily build number, set to 1 for nightly) + VERSION=$(date -u +"%y%m%d")1 + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Calculated VERSION: $VERSION" + wled_build: + needs: calculate_version uses: ./.github/workflows/build.yml + with: + version: ${{ needs.calculate_version.outputs.version }} nightly: name: Deploy nightly runs-on: ubuntu-latest