name: AS & RVPS Container Image Build
on:
  push:
    branches:
      - "main"
    paths:
      - 'attestation-service/**'
      - '.github/workflows/as-docker-build.yml'
      - 'Cargo.toml'
  pull_request:
    paths:
      - 'attestation-service/**'
      - '.github/workflows/as-docker-build.yml'
      - 'Cargo.toml'
  create:

jobs:
  basic_ci:
    if: github.event_name == 'pull_request' || github.event_name == 'push'
    name: Check
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false

    steps:
    - name: Code checkout
      uses: actions/checkout@v4
    
    - name: Build gRPC AS Container Image
      run: |
        DOCKER_BUILDKIT=1 docker build -t attestation-service:latest . -f Dockerfile.as-grpc
    
    - name: Build RESTful AS Container Image
      run: |
        DOCKER_BUILDKIT=1 docker build -t attestation-service:latest . -f Dockerfile.as-restful

    - name: Build RVPS Container Image
      run: |
        Docker_BUILDKIT=1 docker build -t rvps:latest . -f Dockerfile.rvps