name: "tagged-release"

on:
  push:
    tags:
      - "v*"

jobs:
  tagged-release:

    name: "Tagged Release"
    runs-on: ubuntu-latest

    steps:

      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '16'

      - name: Install PlatformIO
        run: |
          python -m pip install --upgrade pip
          pip install -U platformio
          platformio upgrade
          platformio update

      - name: Build WebUI
        run: |
          cd interface
          npm ci
          npm run build

      - name: Build firmware
        run: |
          platformio run -e ci

      - name: Release
        uses: "marvinpinto/action-automatic-releases@latest"
        with:
          repo_token: "${{ secrets.GITHUB_TOKEN }}"
          prerelease: false
          files: |
            CHANGELOG.md
            ./build/firmware/*.*
