name: Create a release draft

on:
  workflow_dispatch:
    inputs:
      tag:
        required: true

jobs:
  release:
    runs-on: ubuntu-latest

    permissions:
      actions: none
      checks: none
      contents: write
      deployments: none
      id-token: none
      issues: read
      discussions: none
      packages: none
      pages: none
      pull-requests: none
      repository-projects: none
      security-events: none
      statuses: none

    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
      - name: Use Node.js
        uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 #v4.0.2
        with:
          node-version: 22.16.0
      - name: npm i
        run: npm i @octokit/rest
      - name: release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: "node buildSrc/releaseNotes --tag tutanota-release-${{ github.event.inputs.tag }}
                                                     --releaseName ${{ github.event.inputs.tag }}
                                                     --milestone ${{ github.event.inputs.tag }}
                                                     --platform all"
