Skip to content

Build Tasmota and Deploy OTA #60

Build Tasmota and Deploy OTA

Build Tasmota and Deploy OTA #60

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
name: Build Tasmota and Deploy OTA
##
## TODO: Create a custom build of Tasmota, see below for more information:
## https://tasmota.github.io/docs/Compile-your-build/#customize-your-build
##
on:
# Runs on pushes targeting the default branch
push:
branches:
- master
# Build on a schedule once a week
schedule:
- cron: '0 0 * * mon'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build Tasmota
build:
name: Build Tasmota
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
# Set up the Tasmota variants to build
strategy:
matrix:
variant:
- tasmota
- tasmota-4M
- tasmota-display
- tasmota-ir
- tasmota-knx
- tasmota-lite
- tasmota-minimal
- tasmota-sensors
- tasmota-zbbridge
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
repository: arendst/Tasmota
# ref: development # Bleeding edge development code
ref: master # Stable release code
# fetch-depth: 1
- name: Setup Python
# if: success()
uses: actions/setup-python@v3
with:
python-version: '3.x' # '3.7' # Version range or exact version of a Python version to use, using semvers version range syntax.
# architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: Install PlatformIO
# if: success()
run: |
# pip install -U platformio
# pio upgrade --dev
# pio pkg update --global
pip install wheel
pip install -U platformio
## TODO: Add a custom rule for a custom build, so we can do eg. battery charger auto-shutoff builds ootb (remember that we need things like SetOption21 too?!)
## https://tasmota.github.io/docs/Compile-your-build/#user_rule
- name: Customize Tasmota
if: ${{ matrix.variant == 'tasmota' || matrix.variant == 'tasmota32' }}
run: |-
# Create the configuration override file
touch tasmota/user_config_override.h
# Enable expression support
echo -e "#define USE_EXPRESSION // Add support for expression evaluation in rules (+3k2 code, +64 bytes mem)" >> tasmota/user_config_override.h
# Enable if statement support
echo -e "#define SUPPORT_IF_STATEMENT // Add support for IF statement in rules (+4k2 code, -332 bytes mem)" >> tasmota/user_config_override.h
# Disable Domoticz support
echo -e "#ifdef USE_DOMOTICZ" >> tasmota/user_config_override.h
echo -e "#undef USE_DOMOTICZ" >> tasmota/user_config_override.h
echo -e "#endif" >> tasmota/user_config_override.h
# Enable BH1750 support (ambient light sensor)
echo -e "#ifndef USE_BH1750" >> tasmota/user_config_override.h
echo -e "#define USE_BH1750 // [I2cDriver11] Enable BH1750 sensor (I2C address 0x23 or 0x5C) (+0k5 code)" >> tasmota/user_config_override.h
echo -e "#endif" >> tasmota/user_config_override.h
# Enable LD2410 support (24GHz mmWave presence/person detector)
echo -e "#ifndef USE_LD2410" >> tasmota/user_config_override.h
echo -e "#define USE_LD2410" >> tasmota/user_config_override.h
echo -e "#endif" >> tasmota/user_config_override.h
- name: Build Tasmota
run: platformio run -e ${{ matrix.variant }}
- name: Upload Build Files
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: tasmota
path: build_output/firmware
# Deploy Tasmota binaries to OTA update website
deploy:
name: Deploy OTA
runs-on: ubuntu-latest
needs: build
timeout-minutes: 5
continue-on-error: true
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: tasmota
path: public/firmware
## FIXME: While this is technically fine, customize the page a bit, especially the title (which incorrectly cites the path)
- name: Generate Directory Listing
uses: jayanta525/[email protected]
with:
FOLDER: public/firmware
- name: Upload Files to GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
# path: public
path: public/firmware
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1