# Automates creation of changelog drafts using Release Drafter
# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
name: Changelog Drafter

on:
  push:
    # branches to consider in the event; optional, defaults to all
    branches:
      - master

jobs:
  update_draft_release:
    runs-on: ubuntu-latest
    steps:
      # Drafts your next Release notes as Pull Requests are merged into "master"
      - name: Generate GitHub Release Draft
        uses: release-drafter/release-drafter@v5.4.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      # Generates a YAML changelog file using https://github.com/jenkinsci/jenkins-core-changelog-generator
      - name: Generate YAML changelog draft
        uses: jenkinsci/jenkins-core-changelog-generator@master
        env:
          GITHUB_AUTH: github-actions:${{ secrets.GITHUB_TOKEN }}
      # TODO(oleg-nenashev): Use te draft generated by Release Drafter, not a fixed release
      # https://github.com/jenkinsci/jenkins/releases/tag/untagged-e3a154d27f5bd99802eb
      - name: Upload changelog YAML to the release draft (untagged-e3a154d27f5bd99802eb)
        uses: svenstaro/upload-release-action@v1-release
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: changelog.yaml
          asset_name: changelog.yaml
          tag: untagged-e3a154d27f5bd99802eb
          overwrite: true

# Automates creation of changelog drafts using Release Drafter
# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
name: Changelog Drafter

on:
  push:
    # branches to consider in the event; optional, defaults to all
    branches:
      - master

jobs:
  update_draft_release:
    runs-on: ubuntu-latest
    steps:
      # Drafts your next Release notes as Pull Requests are merged into "master"
      - name: Generate GitHub Release Draft
        uses: release-drafter/release-drafter@v5.4.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      # Generates a YAML changelog file using https://github.com/jenkinsci/jenkins-core-changelog-generator
      - name: Generate YAML changelog draft
        uses: jenkinsci/jenkins-core-changelog-generator@master
        env:
          GITHUB_AUTH: github-actions:${{ secrets.GITHUB_TOKEN }}

Revert "Upload draft Changelog YAMLs to GitHub Release assets"
Revert "Upload draft Changelog YAMLs to GitHub Release assets"
