branches: 
  - name: 'main'
  - name: 'alpha'
    prerelease: 'alpha'
preset: "angular"
tagFormat: "${version}"
plugins:
  - "@semantic-release/commit-analyzer"
  - "@semantic-release/release-notes-generator"
  - "@semantic-release/changelog"
  - "@semantic-release/git"
  - "@semantic-release/github"
verifyConditions:
  - '@semantic-release/git'
  - "@semantic-release/github"
analyzeCommits:
  - path: "@semantic-release/commit-analyzer"
    releaseRules:
    - type: "feat"
      release: "minor"
    - type: "hotfix"
      release: "patch"
    - type: "fix"
      release: "patch"
    - type: "patch"
      release: "patch"
    - type: "minor"
      release: "minor"
    - type: "breaking"
      release: "major"
    - type: "chore"
      release: "patch"
    - message: "*"
      release: "patch"
generateNotes:
  - path: "@semantic-release/release-notes-generator"
    writerOpts:
      groupBy: "type"
      commitGroupsSort:
        - "hotfix"
        - "feat"
        - "perf"
        - "fix"
      commitsSort: "header"
      mainTemplate: |
        {{> header}}

        {{#if noteGroups}}
        {{#each noteGroups}}

        ### ⚠ {{title}}

        {{#each notes}}
        * {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
        {{/each}}
        {{/each}}
        {{/if}}
        {{#each commitGroups}}

        {{#if title}}
        ### {{title}}

        {{/if}}
        {{#each commits}}
        {{> commit root=@root}}
        {{/each}}

        {{/each}}

        {{> footer}}
      headerPartial: |
        ## OpenBK7231T/OpenBeken release {{version}}
        
        ### WARNING! If installing versions tagged -alpha, please be aware these are development builds and may not be stable! Please do not flash all your devices at once! Make sure you can recover them via UART in case of unexpected issue.

        OpenBK7231T/OpenBeken is a Tasmota/ESPHome alternative for modern IoT wifi devices, offering MQTT and Home Assistant compatibility. Although this repository is named <code>OpenBK7231T_App</code>, it has evolved into a multiplatform application, supporting builds for multiple chipsets from various vendors, including ESWIN, Transa Semi, Lightning Semi, Espressif, Beken, WinnerMicro, Xradiotech/Allwinner, Realtek, and Bouffalo Lab.
        
        - BK7231T (eg WB3S, WB2S, WB2L)
        - BK7231N (eg CB2S, CB2L, WB2L_M1)
        - BK7231S/BK7231U (eg C-8133U, HLK-B30)
        - BK7238 (eg NiceMCU, XH-CB3S)
        - BK7252 (eg A9 cameras, for testing only! No camera driver is implemented.)
        - BK7252N
        - T34 (based on BK7231N)
        - BL2028N (based on BK7231N)
        - CC8000 (based on BK7231U)
        - XR809 (eg XR2, XR3)
        - XR806 (eg T103C-HL, WXU)
        - XR872/XF16
        - BL602 (eg DT-BL200, SM-028_V1.3)
        - LF686 (based on BL602)
        - TG7100C (based on BL602) (eg YX-X3-T71C-VER03)
        - W800 (W800-C400, WinnerMicro WiFi & Bluetooth), W801
        - W600 (eg TW-01, TW-02, TW-03), W601 (WIS600, ESP-01W)
        - LN882H (eg LN-02, WL2S, WL2H)
        - ESP32 (including other xtensa/riscv variants)
        - ESP8285/ESP8266 1MB/2MB (eg TYWE3S, TYWE2S, ESP-01S, ESP-M2) 
        - TR6260 (eg HLK-M20, XY-WE2S-A V1.1)
        - RTL8711AM (Ameba1 family, models with SDRAM only) (eg WRG1)
        - RTL8710B (AmebaZ family) (eg T102_V1.0, W302/T102_V1.0, T112_V1.1, WR2, WR3E, BW14)
        - RTL8710C/RTL8720C (AmebaZ2 family) (eg BW15, W701, W701H, WBR2, WBR3, CR3L, CRG1)
        - RTL8720D (AmebaD family) (eg BW16, BW16E, W701D, W701DH, WBR3D, WBR3T)
        - RTL872xCSM/RTL8720CS (AmebaCS family) (eg WBRG1, WBR3S, WBR3N) (Firmware compatible with RTL8720D)
        - RTL87x1DA (AmebaDplus family) (eg BW20, WR11-U, WR11-2S)
        - RTL87x0E (AmebaLite family) (eg PKM8710ECF)
        - ECR6600 (eg AXYU, AXY2S, WG236, DSM-036, CDI-WX56600A-00, BL-M6600XT1, HF-LPT6200)
        - TXW81X (eg TXW817-810)
        - RDA5981 (eg RDA5981AM, RDA5981BM, WRD2L, TYWRD3S, HLK-M50)

      footerPartial: |
        {{#if noteGroups}}
        {{#each noteGroups}}

        ### {{title}}

        {{#each notes}}
        * {{text}}
        {{/each}}
        {{/each}}
        {{/if}}

        ### Assets
        Refer to the following table for the usage of the various assets included in this release
        | Platform       | Usage      | Filename                                                                                                                                           |
        | ---            | ---        | ---                                                                                                                                                |
        | BK7231T        | OTA Update | [OpenBK7231T_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_{{version}}.rbl)                         |
        | BK7231T        | CCtr Flash | [OpenBK7231T_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UG_{{version}}.bin)                   |
        | BK7231T        | UART Flash | [OpenBK7231T_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UA_{{version}}.bin)                   |
        | BK7231T        | SPI Flash  | [OpenBK7231T_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_QIO_{{version}}.bin)                 |
        | BK7231N        | OTA Update | [OpenBK7231N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_{{version}}.rbl)                         |
        | BK7231N        | CCtr Flash | [OpenBK7231N_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_UG_{{version}}.bin)                   |
        | BK7231N        | UART Flash | [OpenBK7231N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_QIO_{{version}}.bin)                 |
        | BK7231M        | UART Flash | [OpenBK7231M_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231M_QIO_{{version}}.bin)                 |
        | BK7231U        | OTA Update | [OpenBK7231U_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_{{version}}.rbl)                         |
        | BK7231U        | UART Flash | [OpenBK7231U_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_UA_{{version}}.bin)                   |
        | BK7231U        | SPI Flash  | [OpenBK7231U_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_QIO_{{version}}.bin)                 |
        | BK7238         | OTA Update | [OpenBK7238_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_{{version}}.rbl)                           |
        | BK7238         | UART Flash | [OpenBK7238_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_QIO_{{version}}.bin)                   |
        | BK7252         | OTA Update | [OpenBK7252_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_{{version}}.rbl)                           |
        | BK7252         | UART Flash | [OpenBK7252_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_UA_{{version}}.bin)                     |
        | BK7252         | SPI Flash  | [OpenBK7252_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_QIO_{{version}}.bin)                   |
        | BK7252N        | OTA Update | [OpenBK7252N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_{{version}}.rbl)                         |
        | BK7252N        | UART Flash | [OpenBK7252N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_QIO_{{version}}.bin)                 |
        | XR809          | UART Flash | [OpenXR809_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR809_{{version}}.img)                             |
        | XR806          | UART Flash | [OpenXR806_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}.img)                             |
        | XR806          | OTA Update | [OpenXR806_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}_ota.img)                     |
        | XR872          | UART Flash | [OpenXR872_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}.img)                             |
        | XR872          | OTA Update | [OpenXR872_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}_ota.img)                     |
        | BL602          | UART Flash | [OpenBL602_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}.bin)                             |
        | BL602          | OTA Update | [OpenBL602_{{version}}_OTA.bin.xz.ota]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}_OTA.bin.xz.ota)       |
        | W800           | OTA Update | [OpenW800_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}_ota.img)                       |
        | W800           | UART Flash | [OpenW800_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}.fls)                               |
        | W600           | OTA Update | [OpenW600_{{version}}_gz.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}_gz.img)                         |
        | W600           | UART Flash | [OpenW600_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}.fls)                               |
        | LN882H         | OTA Update | [OpenLN882H_{{version}}_OTA.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}_OTA.bin)                   |
        | LN882H         | UART Flash | [OpenLN882H_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}.bin)                           |
        | TR6260         | UART Flash | [OpenTR6260_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenTR6260_{{version}}.bin)                           |
        | RTL8710A       | JTAG Flash | [OpenRTL8710A_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}.bin)                       |
        | RTL8710A       | OTA Update | [OpenRTL8710A_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}_ota.img)               |
        | RTL8710B       | UART Flash | [OpenRTL8710B_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}.bin)                       |
        | RTL8710B       | OTA Update | [OpenRTL8710B_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}_ota.img)               |
        | RTL8710B       | CCtr Flash | [OpenRTL8710B_UG_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_UG_{{version}}.img)                 |
        | RTL87X0C       | UART Flash | [OpenRTL87X0C_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}.bin)                       |
        | RTL87X0C       | OTA Update | [OpenRTL87X0C_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}_ota.img)               |
        | RTL8720D       | UART Flash | [OpenRTL8720D_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}.bin)                       |
        | RTL8720D       | OTA Update | [OpenRTL8720D_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}_ota.img)               |
        | RTL8721DA      | UART Flash | [OpenRTL8721DA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8721DA_{{version}}.bin)                     |
        | RTL8721DA      | OTA Update | [OpenRTL8721DA_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8721DA_{{version}}_ota.img)             |
        | RTL8720E       | UART Flash | [OpenRTL8720E_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720E_{{version}}.bin)                       |
        | RTL8720E       | OTA Update | [OpenRTL8720E_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720E_{{version}}_ota.img)               |
        | ECR6600        | UART Flash | [OpenECR6600_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}.bin)                         |
        | ECR6600        | OTA Update | [OpenECR6600_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}_ota.img)                 |
        | ESP32 4MB      | UART Flash | [OpenESP32_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.factory.bin)       |
        | ESP32 4MB      | OTA Update | [OpenESP32_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.img)                       |
        | ESP32-S2 4MB   | UART Flash | [OpenESP32S2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.factory.bin)   |
        | ESP32-S2 4MB   | OTA Update | [OpenESP32S2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.img)                   |
        | ESP32-S3 4MB   | UART Flash | [OpenESP32S3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.factory.bin)   |
        | ESP32-S3 4MB   | OTA Update | [OpenESP32S3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.img)                   |
        | ESP32-C2 2MB   | UART Flash | [OpenESP32C2_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.factory.bin)   |
        | ESP32-C2 2MB   | OTA Update | [OpenESP32C2_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.img)                   |
        | ESP32 C2 4MB   | UART Flash | [OpenESP32C2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.factory.bin)   |
        | ESP32 C2 4MB   | OTA Update | [OpenESP32C2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.img)                   |
        | ESP32-C3 2MB   | UART Flash | [OpenESP32C3_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.factory.bin)   |
        | ESP32-C3 2MB   | OTA Update | [OpenESP32C3_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.img)                   |
        | ESP32 C3 4MB   | UART Flash | [OpenESP32C3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.factory.bin)   |
        | ESP32 C3 4MB   | OTA Update | [OpenESP32C3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.img)                   |
        | ESP32 C5 4MB   | UART Flash | [OpenESP32C5_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.factory.bin)   |
        | ESP32 C5 4MB   | OTA Update | [OpenESP32C5_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.img)                   |
        | ESP32-C6 4MB   | UART Flash | [OpenESP32C6_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.factory.bin)   |
        | ESP32-C6 4MB   | OTA Update | [OpenESP32C6_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.img)                   |
        | ESP32 C61 4MB  | UART Flash | [OpenESP32C61_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.factory.bin) |
        | ESP32 C61 4MB  | OTA Update | [OpenESP32C61_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.img)                 |
        | ESP8266 1MB    | UART Flash | [OpenESP8266_1MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_1MB_{{version}}.factory.bin) |
        | ESP8266 2MB    | UART Flash | [OpenESP8266_2MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_2MB_{{version}}.factory.bin) |
        | ESP8266 2MB    | OTA Update | [OpenESP8266_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_{{version}}.img)                         |
        | RDA5981        | UART Flash | [OpenRDA5981_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRDA5981_{{version}}.bin)                         |
        | RDA5981        | OTA Update | [OpenRDA5981_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRDA5981_{{version}}_ota.img)                 |
        | TXW81X         |            | [OpenTXW81X_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenTXW81X_{{version}}.bin)                           |
        | Win32          |            | [obkSimulator_{{version}}.zip]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/obkSimulator_{{version}}.zip)                       |


        CCtr Flash = Tuya cloud Cutter flash
        SPI Flash can be flashed through SPI, even if you broke BK bootloader
        BK7231M is basically a BK7231N but with 000000 encryption keys. BK7231EasyGUIFlasher will show the encryption keys and warn you if you are trying to flash BK7231N with 000000 keys.
        BK7231M binary will work also for some BL2028Ns, they are also often just a BK7231N with 000000 etc keys.

        RTL8710A (RTL8711AM) can be flashed either via JTAG/SWD, or CH341A SPI.
        TXW81X must be flashed via CK-Link

        Flashing instructions are available on the project's [README.md]({{host}}/{{owner}}/{{repository}}#readme)
    preset: conventionalcommits
    presetConfig:
      types:
        - type: "feat"
          section: "Features"
        # Tracked bug fix with a hotfix branch
        - type: "hotfix"
          section: "Bug Fixes"
        # Uninmportent fix (CI testing, etc)
        - type: "fix"
          section: "Bug Fixes"
          hidden: false
        - type: "chore"
          section: "Changes"
          hidden: false
        - type: "docs"
          section: "Changes"
          hidden: false
        - type: "doc"
          section: "Changes"
          hidden: false
        - type: "style"
          section: "Changes"
          hidden: false
        - type: "refactor"
          section: "Changes"
          hidden: false
        - type: "perf"
          section: "Changes"
          hidden: false
        - type: "test"
          section: "Changes"
          hidden: false
        - type: ""
          section: "Changes"
          hidden: false
prepare:
  - path: "@semantic-release/git"
publish:
  - path: "@semantic-release/github"
    addReleases: "bottom"
    assets:
      - path: "output/**/*_UA_*.bin"
      - path: "output/**/*_UG_*.bin"
      - path: "output/**/*_QIO_*.bin"
      - path: "output/**/*.rbl"
      - path: "output/**/*.img"
      - path: "output/**/OpenBL602*"
      - path: "output/**/OpenW600*"
      - path: "output/**/OpenW800*"
      - path: "output/**/OpenLN882H*"
      - path: "output/**/OpenTR6260*"
      - path: "output/**/OpenRTL87*"
      - path: "output/**/OpenESP*"
      - path: "output/**/OpenECR*"
      - path: "output/**/OpenTXW*"
      - path: "output/**/OpenRDA*"
      - path: "output/**/obkSimulator*"

success:
  - "@semantic-release/github"

fail:
  - "@semantic-release/github"
