name: ReleaseNotice
on:
  release:
    types: [published]
  workflow_dispatch:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # To check the github context
      - name: Dump Github context
        env:
          GITHUB_CONTEXT: ${{ toJSON(github) }}
        run: echo "$GITHUB_CONTEXT"
      - name: Slack Notification on SUCCESS
        if: success()
        uses: tokorom/action-slack-incoming-webhook@main
        env:
          INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        with:
          text: A release is published.
          blocks: |
            [
              {
                "type": "header",
                "text": {
                  "type": "plain_text",
                  "text": "Expo Config Plugin for iOS Screen Share with ${{ github.event.release.tag_name}} is published!"
                }
              },
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "*Author:*\n${{ github.actor }}"
                }
              },
               {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "*Release Information:*"
                }
              },
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": ${{ toJSON(github.event.release.body) }}
                }
              },
              {
                "type": "section",
                "text": {
                  "type": "mrkdwn",
                  "text": "${{ github.event.release.html_url }}"
                }
              }
            ]
