-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update checkout action. * update checkout action version. * update checkout action. * fix.
- Loading branch information
Showing
3 changed files
with
80 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ jobs: | |
fail-fast: false | ||
steps: | ||
- name: Checkout current branch | ||
uses: actions/checkout@v3.2.0 | ||
uses: actions/checkout@v3.3.0 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Scala and Java | ||
|
@@ -40,7 +40,7 @@ jobs: | |
java: ['[email protected]', '[email protected]'] | ||
scala: ['2.12.17'] | ||
steps: | ||
- uses: actions/checkout@v3.2.0 | ||
- uses: actions/checkout@v3.3.0 | ||
- uses: olafurpg/setup-scala@v13 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
@@ -55,7 +55,7 @@ jobs: | |
needs: [build,lint] | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v3.2.0 | ||
- uses: actions/checkout@v3.3.0 | ||
with: | ||
fetch-depth: 0 | ||
- uses: olafurpg/setup-scala@v13 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,68 @@ object WebsiteUtils { | |
docsPublishBranch: String, | ||
sbtBuildOptions: List[String] = List.empty, | ||
versioning: DocsVersioning = SemanticVersioning | ||
): String = | ||
): String = { | ||
object Actions { | ||
val checkout: ActionRef = ActionRef("actions/[email protected]") | ||
val `setup-java`: ActionRef = ActionRef("actions/[email protected]") | ||
val `setup-node`: ActionRef = ActionRef("actions/setup-node@v3") | ||
} | ||
|
||
import Actions.* | ||
|
||
object Steps { | ||
val Checkout: Step.SingleStep = Step.SingleStep( | ||
name = "Git Checkout", | ||
uses = Some(checkout), | ||
parameters = Map("fetch-depth" -> "0".asJson) | ||
) | ||
|
||
val SetupJava: Step.SingleStep = Step.SingleStep( | ||
name = "Setup Scala", | ||
uses = Some(`setup-java`), | ||
parameters = Map( | ||
"distribution" -> "temurin".asJson, | ||
"java-version" -> 17.asJson, | ||
"check-latest" -> true.asJson | ||
) | ||
) | ||
|
||
val SetupNodeJs: Step.SingleStep = Step.SingleStep( | ||
name = "Setup NodeJs", | ||
uses = Some(`setup-node`), | ||
parameters = Map( | ||
"node-version" -> "16.x".asJson, | ||
"registry-url" -> "https://registry.npmjs.org".asJson | ||
) | ||
) | ||
|
||
val GenerateReadme: Step.SingleStep = Step.SingleStep( | ||
name = "Generate Readme", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/generateReadme") | ||
) | ||
|
||
val CheckWebsiteBuildProcess: Step.SingleStep = Step.SingleStep( | ||
name = "Check website build process", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/buildWebsite") | ||
) | ||
|
||
val CheckGithubWorkflow: Step.SingleStep = Step.SingleStep( | ||
name = "Check that site workflow is up to date", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/checkGithubWorkflow") | ||
) | ||
|
||
val PublishToNpmRegistry: Step.SingleStep = | ||
Step.SingleStep( | ||
name = "Publish Docs to NPM Registry", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/${versioning.npmCommand}"), | ||
env = Map( | ||
"NODE_AUTH_TOKEN" -> "${{ secrets.NPM_TOKEN }}" | ||
) | ||
) | ||
} | ||
|
||
import Steps.* | ||
|
||
io.circe.yaml | ||
.Printer( | ||
preserveOrder = true, | ||
|
@@ -201,28 +262,10 @@ object WebsiteUtils { | |
steps = Seq( | ||
Step.StepSequence( | ||
Seq( | ||
Step.SingleStep( | ||
name = "Git Checkout", | ||
uses = Some(ActionRef("actions/[email protected]")), | ||
parameters = Map("fetch-depth" -> "0".asJson) | ||
), | ||
Step.SingleStep( | ||
name = "Setup Scala", | ||
uses = Some(ActionRef("actions/[email protected]")), | ||
parameters = Map( | ||
"distribution" -> "temurin".asJson, | ||
"java-version" -> 17.asJson, | ||
"check-latest" -> true.asJson | ||
) | ||
), | ||
Step.SingleStep( | ||
name = "Check that site workflow is up to date", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/checkGithubWorkflow") | ||
), | ||
Step.SingleStep( | ||
name = "Check website build process", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/buildWebsite") | ||
) | ||
Checkout, | ||
SetupJava, | ||
CheckGithubWorkflow, | ||
CheckWebsiteBuildProcess | ||
) | ||
) | ||
) | ||
|
@@ -239,35 +282,10 @@ object WebsiteUtils { | |
steps = Seq( | ||
Step.StepSequence( | ||
Seq( | ||
Step.SingleStep( | ||
name = "Git Checkout", | ||
uses = Some(ActionRef("actions/[email protected]")), | ||
parameters = Map("fetch-depth" -> "0".asJson) | ||
), | ||
Step.SingleStep( | ||
name = "Setup Scala", | ||
uses = Some(ActionRef("actions/[email protected]")), | ||
parameters = Map( | ||
"distribution" -> "temurin".asJson, | ||
"java-version" -> 17.asJson, | ||
"check-latest" -> true.asJson | ||
) | ||
), | ||
Step.SingleStep( | ||
name = "Setup NodeJs", | ||
uses = Some(ActionRef("actions/setup-node@v3")), | ||
parameters = Map( | ||
"node-version" -> "16.x".asJson, | ||
"registry-url" -> "https://registry.npmjs.org".asJson | ||
) | ||
), | ||
Step.SingleStep( | ||
name = "Publish Docs to NPM Registry", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/${versioning.npmCommand}"), | ||
env = Map( | ||
"NODE_AUTH_TOKEN" -> "${{ secrets.NPM_TOKEN }}" | ||
) | ||
) | ||
Checkout, | ||
SetupJava, | ||
SetupNodeJs, | ||
PublishToNpmRegistry | ||
) | ||
) | ||
) | ||
|
@@ -279,25 +297,14 @@ object WebsiteUtils { | |
steps = Seq( | ||
Step.SingleStep( | ||
name = "Git Checkout", | ||
uses = Some(ActionRef("actions/checkout@v3.2.0")), | ||
uses = Some(checkout), | ||
parameters = Map( | ||
"ref" -> "${{ github.head_ref }}".asJson, | ||
"fetch-depth" -> "0".asJson | ||
) | ||
), | ||
Step.SingleStep( | ||
name = "Setup Scala", | ||
uses = Some(ActionRef("actions/[email protected]")), | ||
parameters = Map( | ||
"distribution" -> "temurin".asJson, | ||
"java-version" -> 17.asJson, | ||
"check-latest" -> true.asJson | ||
) | ||
), | ||
Step.SingleStep( | ||
name = "Generate Readme", | ||
run = Some(s"sbt ${sbtBuildOptions.mkString(" ")} docs/generateReadme") | ||
), | ||
SetupJava, | ||
GenerateReadme, | ||
Step.SingleStep( | ||
name = "Commit Changes", | ||
run = Some("""|git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
|
@@ -327,6 +334,7 @@ object WebsiteUtils { | |
) | ||
).asJson | ||
) | ||
} | ||
|
||
def releaseVersion(logger: String => Unit): Option[String] = | ||
try "git tag --sort=committerdate".!!.split("\n").filter(_.startsWith("v")).lastOption.map(_.tail) | ||
|