Skip to content

Commit

Permalink
update ci release jobs and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rolang committed Jul 13, 2024
1 parent cabc4d0 commit c20015f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 67 deletions.
62 changes: 8 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
run: sbt +publishLocal
- name: Check website build process
run: sbt docs/clean; sbt docs/buildWebsite
- name: Upload website build
uses: actions/upload-pages-artifact@v3
with:
path: zio-pubsub-docs/target/website/build
lint:
name: Lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -201,62 +205,12 @@ jobs:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
release-docs:
name: Release Docs
deploy-website:
name: Deploy website
runs-on: ubuntu-latest
continue-on-error: false
needs:
- release
if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install libuv
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
- name: Setup Scala
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: '17'
check-latest: true
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Setup NodeJs
uses: actions/setup-node@v4
with:
node-version: 16.x
registry-url: https://registry.npmjs.org
- name: Publish Docs to NPM Registry
run: sbt docs/publishToNpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
notify-docs-release:
name: Notify Docs Release
runs-on: ubuntu-latest
continue-on-error: false
needs:
- release-docs
if: ${{ (github.event_name == 'release') && (github.event.action == 'published') }}
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: notify the main repo about the new release of docs package
run: |
PACKAGE_NAME=$(cat docs/package.json | grep '"name"' | awk -F'"' '{print $4}')
PACKAGE_VERSION=$(npm view $PACKAGE_NAME version)
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.PAT_TOKEN }}"\
https://api.github.com/repos/zio/zio/dispatches \
-d '{
"event_type":"update-docs",
"client_payload":{
"package_name":"'"${PACKAGE_NAME}"'",
"package_version": "'"${PACKAGE_VERSION}"'"
}
}'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
49 changes: 36 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import zio.sbt.githubactions.{Job, Step, Condition}
import zio.sbt.githubactions.{Job, Step, Condition, ActionRef}
import _root_.io.circe.Json
enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)

lazy val _scala2 = "2.13.14"
Expand Down Expand Up @@ -26,7 +27,7 @@ inThisBuild(
url = url("https://github.com/qhquanghuy"),
),
),
zioVersion := "2.1.5",
zioVersion := "2.1.6",
scala213 := _scala2,
scala3 := _scala3,
scalaVersion := _scala2,
Expand All @@ -36,14 +37,20 @@ inThisBuild(
ciJvmOptions ++= Seq("-Xms2G", "-Xmx2G", "-Xss4M", "-XX:+UseG1GC"),
ciTargetJavaVersions := Seq("17", "21"),
ciBuildJobs := ciBuildJobs.value.map { j =>
j.copy(steps = j.steps.map {
case s @ Step.SingleStep("Check all code compiles", _, _, _, _, _, _) =>
Step.SingleStep(
name = s.name,
run = Some("sbt '+Test/compile; +examples/compile'"),
)
case s => s
})
j.copy(steps =
j.steps.map {
case s @ Step.SingleStep("Check all code compiles", _, _, _, _, _, _) =>
Step.SingleStep(
name = s.name,
run = Some("sbt '+Test/compile; +examples/compile'"),
)
case s => s
} :+ Step.SingleStep(
name = "Upload website build",
uses = Some(ActionRef("actions/upload-pages-artifact@v3")),
parameters = Map("path" -> Json.fromString("zio-pubsub-docs/target/website/build")),
)
)
},
ciTestJobs := ciTestJobs.value.map {
case j if j.id == "test" =>
Expand Down Expand Up @@ -78,6 +85,22 @@ inThisBuild(
}
)
),
// this overrides the default post release jobs generated by zio-sbt-ci which publish the docs to NPM Registry
// can try to make it work with NPM later
ciPostReleaseJobs := Seq(
Job(
id = "deploy-website",
name = "Deploy website",
need = Seq("release"),
runsOn = "ubuntu-latest",
steps = Seq(
Step.SingleStep(
name = "Deploy to GitHub Pages",
uses = Some(ActionRef("actions/deploy-pages@v4")),
)
),
)
),
scalafmt := true,
scalafmtSbtCheck := true,
scalafixDependencies ++= List(
Expand Down Expand Up @@ -146,7 +169,7 @@ lazy val zioPubsub = crossProject(JVMPlatform, NativePlatform)
)
)

val vulcanVersion = "1.10.1"
val vulcanVersion = "1.11.0"
lazy val zioPubsubSerdeVulcan = (project in file("zio-pubsub-serde-vulcan"))
.settings(moduleName := "zio-pubsub-serde-vulcan")
.dependsOn(zioPubsub.jvm)
Expand All @@ -158,7 +181,7 @@ lazy val zioPubsubSerdeVulcan = (project in file("zio-pubsub-serde-vulcan"))
)
)

val circeVersion = "0.14.7"
val circeVersion = "0.14.8"
lazy val zioPubsubSerdeCirce = crossProject(JVMPlatform, NativePlatform)
.in(file("zio-pubsub-serde-circe"))
.settings(moduleName := "zio-pubsub-serde-circe")
Expand All @@ -172,7 +195,7 @@ lazy val zioPubsubSerdeCirce = crossProject(JVMPlatform, NativePlatform)
)
)

val googleCloudPubsubVersion = "1.130.1"
val googleCloudPubsubVersion = "1.131.0"
lazy val zioPubsubGoogle = (project in file("zio-pubsub-google"))
.settings(moduleName := "zio-pubsub-google")
.dependsOn(zioPubsub.jvm)
Expand Down

0 comments on commit c20015f

Please sign in to comment.