diff --git a/README.md b/README.md index 40d3c03..10ad0f8 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ ThisBuild / githubWorkflowPublish := Seq( ### General +- `githubWorkflowDir` : `File` - Where to place the workflow directory which contains the generated ci.yml and clean.yml files. (default: `baseDirectory.value / ".github"`) - `githubIsWorkflowBuild` : `Boolean` – Indicates whether or not the build is currently running within a GitHub Actions Workflow - `githubWorkflowName` : `String` – The name of the currently-running workflow. Will be undefined if not running in GitHub Actions. - `githubWorkflowDefinition` : `Map[String, Any]` – The raw (parsed) contents of the workflow YAML definition. Will be undefined if not running in GitHub Actions, or if (for some reason) the workflow could not be identified. Workflows are located by taking the `githubWorkflowName` and finding the YAML definition which has the corresponding `name:` key/value pair. diff --git a/src/main/scala/sbtghactions/GenerativeKeys.scala b/src/main/scala/sbtghactions/GenerativeKeys.scala index ae1e634..255eba3 100644 --- a/src/main/scala/sbtghactions/GenerativeKeys.scala +++ b/src/main/scala/sbtghactions/GenerativeKeys.scala @@ -25,6 +25,7 @@ trait GenerativeKeys { lazy val githubWorkflowGenerate = taskKey[Unit]("Generates (and overwrites if extant) a ci.yml and clean.yml actions description according to configuration") lazy val githubWorkflowCheck = taskKey[Unit]("Checks to see if the ci.yml and clean.yml files are equivalent to what would be generated and errors if otherwise") + lazy val githubWorkflowDir = settingKey[File]("Where to place the workflow directory which contains the generated ci.yml and clean.yml files. (default: baseDirectory.value / \".github\")") lazy val githubWorkflowGeneratedCI = settingKey[Seq[WorkflowJob]]("The sequence of jobs which will make up the generated ci workflow (ci.yml)") lazy val githubWorkflowGeneratedUploadSteps = settingKey[Seq[WorkflowStep]]("The sequence of steps used to upload intermediate build artifacts for an adjacent job") lazy val githubWorkflowGeneratedDownloadSteps = settingKey[Seq[WorkflowStep]]("The sequence of steps used to download intermediate build artifacts published by an adjacent job") diff --git a/src/main/scala/sbtghactions/GenerativePlugin.scala b/src/main/scala/sbtghactions/GenerativePlugin.scala index a8af4a7..dcc5fb1 100644 --- a/src/main/scala/sbtghactions/GenerativePlugin.scala +++ b/src/main/scala/sbtghactions/GenerativePlugin.scala @@ -793,7 +793,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} } private val workflowsDirTask = Def task { - val githubDir = baseDirectory.value / ".github" + val githubDir = githubWorkflowDir.value val workflowsDir = githubDir / "workflows" if (!githubDir.exists()) { @@ -867,7 +867,8 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)} if (includeClean) compare(cleanYml, expectedCleanContents) - }) + }, + githubWorkflowDir := baseDirectory.value / ".github") private[sbtghactions] def diff(expected: String, actual: String): String = { val expectedLines = expected.split("\n", -1)