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

on:
  push:
    branches:
      - 'staging'

jobs:
  CreateImage:
    runs-on: [squizstaging]
    uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
    with:
      runner: hubstaging
    secrets:
      REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
      REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
  ValidateConfig:
    runs-on: [squizstaging]
    uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/validate_config.yml@v1.2.1
    needs: CreateImage
    with:
      runner: hubstaging
    secrets:
      REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
      REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
  MigrateDatabase:
    runs-on: [squizstaging]
    uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/migrate.yml@9263e22095fa40bcb36881ad81722d3049acd07f
    needs: ValidateConfig
    with:
      runner: hubstaging
      branch_name: ${{ github.ref_name }}
    secrets:
      REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
      REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
  DeployService:
    runs-on: [squizstaging]
    needs: MigrateDatabase
    uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
    with:
      runner: hubstaging
      actionid: ${{ gitea.run_id }}
    

