name: Make go tag

on:
  push:
    tags:
      - "[0-9]+.[0-9]+.[0-9]+"

permissions: {}

jobs:
  make-go-tag:
    name: Make a vM.m.P tag
    outputs:
      status: ${{ job.status }}
    permissions:
      contents: write
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          persist-credentials: false

      - name: Make go version tag
        uses: senzing-factory/github-action-make-go-tag@v2
        with:
          actor: ${{ secrets.SENZING_GITHUB_ACTOR }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
          gpg_private_key: ${{ secrets.SENZING_GITHUB_GPG_PRIVATE_KEY }}
          gpg_passphrase: ${{ secrets.SENZING_GITHUB_GPG_PASSPHRASE }}

  slack-notification:
    needs: [make-go-tag]
    if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.make-go-tag.outputs.status ) }}
    secrets:
      SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
    uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v3
    with:
      job-status: ${{ needs.make-go-tag.outputs.status }}
