name: Releases

on:
  push:
    tags:
      - '*'

jobs:

  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: GitHub App token
        id: github_app_token
        uses: tibdex/github-app-token@v1.5.0
        with:
          app_id: ${{ secrets.APP_ID }}
          private_key: ${{ secrets.APP_PRIVATE_KEY }}
          installation_id: 22958780
      - name: Get tag
        id: tag
        uses: dawidd6/action-get-tag@v1
      - uses: actions/checkout@v2
      - uses: ncipollo/release-action@v1
        with:
          github_token: ${{ steps.github_app_token.outputs.token }}
          bodyFile: release-notes/opensearch.release-notes-${{steps.tag.outputs.tag}}.md