name: Publish Draft Release

on:
  workflow_dispatch:
    inputs:
      tag:
        description: Release tag to publish, for example v1.0.42
        required: true

jobs:
  publish-release:
    name: Publish approved draft release
    runs-on: windows
    steps:
      - name: Checkout repository
        uses: https://github.com/actions/checkout@v4

      # - name: Setup Node.js
      #   uses: https://github.com/actions/setup-node@v4
      #   with:
      #     node-version: 20

      - name: Publish draft release
        env:
          GITEA_RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
        run: >
          node tools/gitea-release.js publish
          --server-url "${{ github.server_url }}"
          --repository "${{ github.repository }}"
          --tag "${{ github.event.inputs.tag }}"
