name: zcash-params

# Ensures that only one workflow task will run at a time. Previous deployments, if
# already in process, won't get cancelled. Instead, we let the first to complete
# then queue the latest pending workflow, cancelling any workflows in between
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: false

on:
  workflow_dispatch:
    inputs:
      no_cache:
        description: 'Disable the Docker cache for this build'
        required: false
        type: boolean
        default: false

  push:
    branches:
      - 'main'
    paths:
      # parameter download code
      - 'zebra-consensus/src/primitives/groth16/params.rs'
      - 'zebra-consensus/src/router.rs'
      - 'zebrad/src/commands/download.rs'
      - 'zebrad/src/commands/start.rs'
      # workflow definitions
      - 'docker/zcash-params/Dockerfile'
      - '.dockerignore'
      - '.github/workflows/zcash-params.yml'
      - '.github/workflows/build-docker-image.yml'

jobs:
  build:
    name: Build Zcash Params Docker
    uses: ./.github/workflows/build-docker-image.yml
    with:
      dockerfile_path: ./docker/zcash-params/Dockerfile
      dockerfile_target: release
      image_name: zcash-params
      no_cache: ${{ inputs.no_cache || false }}
      rust_backtrace: full
      rust_lib_backtrace: full
      rust_log: info
