Merge pull request #58 from ohAnd/develop #12
This file contains 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: PlatformIO CI main release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: write temp file with build number and set to env variable | |
run: | | |
touch ${{ github.workspace }}/include/buildnumber.txt | |
printf -v BUILDNUMBER "%04d" ${{github.run_number}} | |
echo $BUILDNUMBER >> ${{ github.workspace }}/include/buildnumber.txt | |
echo "got current buildnumber and saved: " | |
cat ${{ github.workspace }}/include/buildnumber.txt | |
echo "CURRENT_BUILDNUMBER=$BUILDNUMBER" >> $GITHUB_ENV | |
- name: Build PlatformIO Project | |
run: pio run | |
- name: got current version and changing firmware name after building | |
run: | | |
VERSIONNUMBER=$(python ${{ github.workspace }}/version_inc.py getversion 2>&1) | |
echo "got versionnumber: " $VERSIONNUMBER | |
echo "CURRENT_VERSIONNUMBER=$VERSIONNUMBER" >> $GITHUB_ENV | |
mv .pio/build/esp12e/firmware.bin .pio/build/esp12e/dtuGateway_ESP8266_release_$VERSIONNUMBER.bin | |
mv .pio/build/esp32/firmware.bin .pio/build/esp12e/dtuGateway_ESP32_release_$VERSIONNUMBER.bin | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dtuGateway_release_${{ env.CURRENT_VERSIONNUMBER }} | |
path: | | |
.pio/build/esp12e/dtuGateway_ESP8266_release_${{ env.CURRENT_VERSIONNUMBER }}.bin | |
.pio/build/esp12e/dtuGateway_ESP32_release_${{ env.CURRENT_VERSIONNUMBER }}.bin | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ env.CURRENT_VERSIONNUMBER }}" | |
prerelease: false | |
title: "dtuGateway v${{ env.CURRENT_VERSIONNUMBER }}" | |
files: | | |
.pio/build/esp12e/dtuGateway_ESP8266_release_${{ env.CURRENT_VERSIONNUMBER }}.bin | |
.pio/build/esp12e/dtuGateway_ESP32_release_${{ env.CURRENT_VERSIONNUMBER }}.bin | |
include/version.json |