name: Deploy
run-name: ${{ gitea.actor }} build image and push to container registry

on:
  push:
    branches:
      - 'main'

jobs:
#  Validate:
#    runs-on: [hubstaging]
#    steps:
#      - name: Check out repository code
#        uses: http://gitea.pena:3000/PenaDevops/actions.git/checkout@v1
#
#      - name: Setup Go
#        uses: actions/setup-go@v3
#        with:
#          go-version: '1.23'
#
#      - name: Run Validator
#        run: |
#          cd cmd/validator
#          go build -o validator .
#          ./validator
#    #    ошибка если возникла то прервать пайплайн
#    env:
#      MONGO_HOST: ${{ secrets.BB_MONGO_URI }}
  CreateImage:
    runs-on: [hubstaging]
#    needs: Validate
    uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.4-p7
    with:
      runner: hubstaging
    secrets:
      REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
      REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
  DeployService:
    runs-on: [hubprod]
#    needs: [Validate,CreateImage]
    needs: [CreateImage]
    uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.3
    with:
      runner: hubprod
      actionid: ${{ gitea.run_id }}
    

