name: "Tag and release"
on:
  push:
    branches:
      - 'main'

jobs:
  deploy-to-prod:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: 🧷️ Get version
        uses: juliangruber/read-file-action@02bbba9876a8f870efd4ad64e3b9088d3fb94d4b
        id: version
        with:
          path: VERSION

      - name: 🧾️ Get release notes
        uses: juliangruber/read-file-action@02bbba9876a8f870efd4ad64e3b9088d3fb94d4b
        id: release-notes
        with:
          path: RELEASE

      - name: 🏷️ Tag
        id: github-tag-action
        uses: uniswap/github-tag-action@7bddacd4864a0f5671e836721db60174d8a9c399
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          custom_tag: ${{ steps.version.outputs.content }}
          tag_prefix: ""

      - name: 🪽 Release
        uses: actions/create-release@v1.1.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.github-tag-action.outputs.new_tag }}
          release_name: Release ${{ steps.github-tag-action.outputs.new_tag }}
          body: ${{ steps.release-notes.outputs.content }}
