kind: pipeline
type: docker
name: default
 
trigger:
  event:
    - push

steps:
  - name: build
    image: mcr.microsoft.com/dotnet/sdk:6.0
    commands:
      - cd Code/
      - dotnet restore BlazorApp.sln
      - dotnet build BlazorApp.sln -c Release --no-restore

  - name: tests
    image: mcr.microsoft.com/dotnet/sdk:6.0
    commands:
      - cd Code/
      - dotnet restore BlazorApp.sln
      - dotnet test BlazorApp.sln --no-restore
    depends_on: [build]

  - name: generate-and-deploy-docs
    image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer
    failure: ignore
    volumes:
      - name: docs
        path: /docs
    commands:
      - /entrypoint.sh
    when:
      branch:
        - master
    depends_on: [ build ]

  - name: docker-build
    image: plugins/docker
    settings:
       dockerfile: Code/ProjetBlazor/Dockerfile
       context: .
       registry: hub.codefirst.iut.uca.fr
       repo: hub.codefirst.iut.uca.fr/dorian.hodin/projetblazor
       username:
         from_secret: SECRET_REGISTRY_USERNAME
       password:
         from_secret: SECRET_REGISTRY_PASSWORD
    when:
      branch:
        - master

volumes:
- name: docs
  temp: {}