diff --git a/.github/workflows/version_pio_build.yml b/.github/workflows/version_pio_build.yml new file mode 100644 index 0000000..0061b7d --- /dev/null +++ b/.github/workflows/version_pio_build.yml @@ -0,0 +1,46 @@ +name: "Build firmware and add release on tag v*" +on: + push: + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install pyhon + uses: actions/setup-python@v2 + + - name: Install pio + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + + - name: Build noserial + run: pio run --project-dir ./Code --environment attiny841_noserial + + - name: Rename noserial firmware + run: | + mv ./Code/.pio/build/attiny841_noserial/firmware.hex ./Code/.pio/build/attiny841_noserial/megadesk-$GITHUB_REF_NAME.hex + FILENAME=./Code/.pio/build/attiny841_noserial/megadesk-$GITHUB_REF_NAME.hex + echo "FILENAME=$FILENAME" >> $GITHUB_ENV + + - name: Build serial + run: pio run --project-dir ./Code --environment attiny841_serial + + - name: Rename serial firmware + run: | + mv ./Code/.pio/build/attiny841_serial/firmware.hex ./Code/.pio/build/attiny841_serial/megadesk-$GITHUB_REF_NAME-serial.hex + SFILENAME=./Code/.pio/build/attiny841_serial/megadesk-$GITHUB_REF_NAME-serial.hex + echo "SFILENAME=$SFILENAME" >> $GITHUB_ENV + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + ${{ env.FILENAME }} + ${{ env.SFILENAME }} +