Skip to content

Commit a9b71a1

Browse files
committed
Sample
1 parent 31bfc42 commit a9b71a1

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/pull_request.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
run: sbt +publishLocal
3131

3232
# Examples
33-
- name: Compile examples - check library version
34-
run: sbt version | tail -n 1 | awk -F " " '{print $2}' > .version
33+
- name: Update examples/build.sbt
34+
run: sed -i -e "s#SCALAJS_CHROME_VERSION#$(sbt printVersion && cat .version)#" examples/build.sbt
3535

36-
- name: Compile examples - set library version
37-
run: sed -i -e "s#SCALAJS_CHROME_VERSION#$(cat .version)#" examples/project/plugins.sbt && sed -i -e "s#SCALAJS_CHROME_VERSION#$(cat .version)#" examples/build.sbt
36+
- name: Update examples/project/plugins.sbt
37+
run: sed -i -e "s#SCALAJS_CHROME_VERSION#$(sbt printVersion && cat .version)#" examples/project/plugins.sbt
3838

3939
- name: Compile examples
40-
run: cd examples && sbt compile
40+
run: cd examples && cat build.sbt && sbt chromePackage

build.sbt

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import java.nio.file.Files
2+
13
inThisBuild(
24
List(
35
organization := "com.alexitc",
@@ -16,6 +18,8 @@ inThisBuild(
1618

1719
ThisBuild / versionScheme := Some("early-semver")
1820

21+
lazy val printVersion = TaskKey[Unit]("printVersion")
22+
1923
lazy val commonSettings = Seq(
2024
scalacOptions ++= {
2125
Seq(
@@ -78,5 +82,9 @@ val root = project
7882
.in(file("."))
7983
.aggregate(bindings, plugin)
8084
.settings(
81-
publish / skip := true
85+
publish / skip := true,
86+
printVersion := {
87+
val targetFile = baseDirectory.value / ".version"
88+
Files.write(targetFile.toPath, version.value.getBytes(IO.utf8))
89+
}
8290
)

0 commit comments

Comments
 (0)