name: Release Candidate Workflow

on:
  push:
    branches: ['main']
    paths-ignore:
      - "cluster-integration/**"
env:
  GITHUB_ACTION_RUN_ID: ${{ github.run_id }}
  GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
  GORELEASER_VERSION: 0.155.1
jobs:
  go_build_and_test:
    uses: ./.github/workflows/reusable_go_build.yml
    with:
      goBuildTag: staging

  release_candidate:
    name: Release candidate
    runs-on: ubuntu-latest
    needs: [go_build_and_test]
    steps:
      - uses: actions/checkout@v3
      - name: Setup Go environment
        uses: actions/setup-go@v3
        with:
          go-version: 1.19
      - name: GitHub Config Identity
        run: |
          git config --global user.email "ci@datree.io"
          git config --global user.name "datree-ci"
      - name: Run deploy release candidate file
        run: |
          bash ./scripts/deploy_release_candidate.sh
        shell: bash
