Skip to content

OpenDTU Build

OpenDTU Build #490

Workflow file for this run

name: OpenDTU Build
on:
schedule:
- cron: '0 3 * * *'
push:
branches:
- main
env:
GIT_CLONE_URL: https://github.com/tbnobody/OpenDTU.git
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: opendtu_release
name: Get OpenDTU release
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: tbnobody
repo: OpenDTU
excludes: prerelease, draft
- id: last_build
name: Get lastest Build
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: LucaDev
repo: OpenDTU-Build
excludes: prerelease, draft
- name: cancel run if same versions
if: steps.last_build.outputs.release == steps.opendtu_release.outputs.release
uses: andymckay/cancel-action@0.3
- name: Clone OpenDTU
run: git clone $GIT_CLONE_URL opendtu
- name: Get Version
id: get_version
run: |
cd opendtu
git fetch --tags
export TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $TAG
echo "TAG=$TAG" >> $GITHUB_ENV
echo "COMMIT=$(git log --format="%h" -n 1)" >> $GITHUB_ENV
echo 'patches<<EOF' >> $GITHUB_OUTPUT
echo "$(ls -1 ../patches/*.patch)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Patch
run: |
cd opendtu
git apply ../patches/*.patch
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PlatformIO Core
run: pip install --upgrade setuptools platformio
- name: Build PlatformIO Project
run: |
cd opendtu
pio run -e lolin_s2_mini
- uses: actions/create-release@master
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.opendtu_release.outputs.release }}
tag_name: ${{ steps.opendtu_release.outputs.release }}
body: |
OpenDTU commit ${{ env.COMMIT }}
Patches:
${{ steps.get_version.outputs.patches }}
- uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./opendtu/.pio/build/lolin_s2_mini/firmware.bin
asset_name: opendtu-lolin_s2_mini.bin
asset_content_type: application/octet-stream