name: Build Photon on: workflow_dispatch: release: types: [ published ] jobs: build: name: Build and Upload runs-on: ubuntu-22.04 steps: - name: Check out the PR uses: actions/checkout@v4 - name: Select Python 3.7 uses: actions/setup-python@v3 with: python-version: '3.7' architecture: 'x64' - name: Generate Short SHA Environment Variable run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV - name: Install PlatformIO run: | pip install -U platformio pio upgrade --dev pio pkg update --global - name: Compile Artifacts for Release if: github.event_name == 'release' run: | export VERSION_STRING=${{ github.event.release.tag_name }} cd photon pio run cp .pio/build/photon-bmp/firmware.bin ../photon-lumenpnp-${{ github.event.release.tag_name }}.bin cp .pio/build/photon-bmp/firmware.elf ../photon-lumenpnp-${{ github.event.release.tag_name }}.elf - name: Upload Artifacts to Release uses: softprops/action-gh-release@v2 if: github.event_name == 'release' with: files: | photon-lumenpnp-${{ github.event.release.tag_name }}.bin photon-lumenpnp-${{ github.event.release.tag_name }}.elf - name: Compile Artifacts for Workflow Dispatch if: github.event_name != 'release' run: | export VERSION_STRING=debug-${{ env.SHORT_SHA }} cd photon && pio run cp .pio/build/photon-bmp/firmware.bin ../photon-lumenpnp-${{ env.SHORT_SHA }}.bin cp .pio/build/photon-bmp/firmware.elf ../photon-lumenpnp-${{ env.SHORT_SHA }}.elf - name: Upload Artifacts to Workflow Dispatch if: github.event_name != 'release' uses: actions/upload-artifact@v4 with: name: photon-lumenpnp-${{ env.SHORT_SHA }}.bin path: photon-lumenpnp-${{ env.SHORT_SHA }}.elf