name: Notify API on Release

on:
  release:
    types: [published]

jobs:
  notify-api:
    runs-on: debian-trixie
    steps:
      - name: Send API Call for New Release
        run: |
          curl -X POST http://melonx.org/api/new_release \
               -H "Content-Type: application/json" \
               -H "Authorization: Bearer ${{ secrets.MELONX_GITEA_API_KEY }}" \
               -d '{
                    "version_number": "${{ github.event.release.tag_name }}",
                    "download_link": "${{ github.event.release.html_url }}",
                    "changelog": "${{ github.event.release.body }}",
                    "is_latest": true
                  }'
