name: Build_firmware # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch #on: # push: # branches: [ main ] # pull_request: # branches: [ main ] on: push: branches: [ dev ] jobs: # emsesp_pull: # runs-on: ubuntu-latest # continue-on-error: true # steps: # - uses: actions/checkout@v1 # - name: Use latest EMS-ESP development # run: | # git config --local user.name "Platformio BUILD" # git switch -c main # git remote add -f EMS-ESP "https://github.com/proddy/EMS-ESP.git" # git merge EMS-ESP/dev --allow-unrelated-histories # - name: Push EMS-ESP # Push updates of latest EMS-ESP development to repo # uses: ad-m/github-push-action@master # with: # github_token: ${{ secrets.GITHUB_TOKEN }} # branch: 'dev' # force: true emsesp: # needs: emsesp_pull runs-on: ubuntu-latest # continue-on-error: true steps: - uses: actions/checkout@v1 - name: Set up Python uses: actions/setup-python@v1 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -U platformio # platformio upgrade --dev platformio upgrade platformio update - name: Run PlatformIO run: | platformio run - uses: actions/upload-artifact@v2 with: name: firmware path: ./build/firmware Upload: needs: [emsesp] runs-on: ubuntu-latest continue-on-error: true steps: - uses: actions/checkout@v1 - uses: actions/download-artifact@v2 with: name: firmware path: ./mv_firmware - name: Display structure of downloaded files run: ls -R working-directory: ./mv_firmware - name: Move firmware files in sub-folders run: | mkdir -p ./firmware [ ! -f ./mv_firmware/*.bin ] || mv ./mv_firmware/EMS-ESP*.* ./firmware/ [ ! -f ./FIRMWARE.md ] || mv -f ./FIRMWARE.md ./README.md - name: Commit files # transfer the new binaries back into the repository run: | git config --local user.name "Platformio BUILD" git rm -r --cached . git add ./README.md git add -f ./firmware/*.* git commit -m "EMS-ESP binaries" - name: Push changes # push the firmware files to branch firmware uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: 'firmware' force: true