Commit 41fbe7e5 authored by shRabbit's avatar shRabbit
Browse files

Add build_enabled input (build job optional, off by default)

parent 0b646982
Loading
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ spec:
    # project found in the repository root.
    solution_path:
      default: ""
    # Set to "true" to enable the build job. Off by default: enable it on
    # demand when build output is actually needed.
    build_enabled:
      default: false
    # Set to "true" to enable the test job.
    tests_enabled:
      default: false
@@ -70,6 +74,7 @@ variables:
  DOTNET_VERSION: "$[[ inputs.dotnet_version ]]"
  BUILD_CONFIGURATION: "$[[ inputs.configuration ]]"
  BUILD_SOLUTION: "$[[ inputs.solution_path ]]"
  BUILD_ENABLED: "$[[ inputs.build_enabled ]]"
  RUN_TESTS: "$[[ inputs.tests_enabled ]]"
  ENABLE_PUBLISH: "$[[ inputs.publish_enabled ]]"
  PUBLISH_OUTPUT: "$[[ inputs.publish_output ]]"
@@ -94,12 +99,13 @@ dotnet-build:
    - if [ -z "$DOTNET_BUILD_ARGS" ]; then echo "No solution/project specified, skipping build." && exit 0; fi
    - dotnet build "$DOTNET_BUILD_ARGS" -p:Configuration="$BUILD_CONFIGURATION"
  artifacts:
    paths:
      - "**/bin/$BUILD_CONFIGURATION/**"
    paths: $[[ inputs.build_artifact_paths ]]
    exclude:
      - "**/obj/**"
    expire_in: 7 days
  rules:
    - if: '$BUILD_ENABLED != "true"'
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never