diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e064c197..067dc566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,28 +28,32 @@ jobs: sbt -v scalafmtSbtCheck scalafmtCheckAll scripted makeSite - name: Pandoc English + if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && github.ref == 'refs/heads/1.x' }} uses: eed3si9n/pandoc@master with: args: '--pdf-engine=xelatex --toc -s -o target/pamflet/sbt-reference.pdf target/pamflet/Combined+Pages+Pdf.md' - name: Pandoc Japanese + if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && github.ref == 'refs/heads/1.x' }} uses: eed3si9n/pandoc@master with: args: '--pdf-engine=xelatex -V CJKmainfont="Noto Sans JP" --toc -s -o target/pamflet/ja/sbt-reference.pdf target/pamflet/ja/Combined+Pages+Pdf.md' - name: Pandoc Chinese + if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && github.ref == 'refs/heads/1.x' }} uses: eed3si9n/pandoc@master with: args: '--pdf-engine=xelatex -V CJKmainfont="Noto Sans SC" --toc -s -o target/pamflet/zh-cn/sbt-reference.pdf target/pamflet/zh-cn/Combined+Pages+Pdf.md' - name: Pandoc Spanish + if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && github.ref == 'refs/heads/1.x' }} uses: eed3si9n/pandoc@master with: args: '--pdf-engine=xelatex --toc -s -o target/pamflet/es/sbt-reference.pdf target/pamflet/es/Combined+Pages+Pdf.md' # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - name: Deploy to GH Pages - if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/1.x-beta') }} + if: ${{ github.event_name == 'push' && github.repository == 'sbt/website' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/1.x' || github.ref == 'refs/heads/1.x-beta') }} run: .github/publish-site.sh env: DEPLOY_KEY_PASSPHRASE: ${{ secrets.DEPLOY_KEY_PASSPHRASE }} diff --git a/build.sbt b/build.sbt index c68e5a62..b8061e5b 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,7 @@ ThisBuild / scalafmtOnCompile := true lazy val root = (project in file(".")) .enablePlugins( - (if (!isBetaBranch) Seq(DocusaurusSitePlugin) else Seq()) ++ + (if (isDevelopBranch) Seq(DocusaurusSitePlugin) else Seq()) ++ Seq(LowTechSnippetPamfletPlugin, ScriptedPlugin): _* ) .settings( diff --git a/project/Docs.scala b/project/Docs.scala index fe1e8f71..a59fec13 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -21,13 +21,15 @@ object Docs { lazy val RedirectTutorial = config("redirect-tutorial") lazy val RedirectLanding = config("redirect-landing") - lazy val isBetaBranch = { - val branch = Process("git rev-parse --abbrev-ref HEAD").!!.linesIterator.toList.head - val travisBranch = sys.env.get("TRAVIS_BRANCH").getOrElse("") - branch == "1.x-beta" || travisBranch == "1.x-beta" - } + lazy val branch = Process("git rev-parse --abbrev-ref HEAD").!!.linesIterator.toList.head + lazy val githubRefName = sys.env.get("GITHUB_REF_NAME").getOrElse("") + // check the environment variable first + def isBranch(b: String): Boolean = (githubRefName == b || branch == b) + def isBetaBranch = isBranch("1.x-beta") + def is1xBranch = isBranch("1.x") + def isDevelopBranch = isBranch("develop") - // New documents will live under /1.x/ instead of /x.y.z/. + // 1.x documents will live under /1.x/ instead of /x.y.z/. // Currently the following files needs to be manually updated: // - src/reference/template.properties lazy val targetSbtBinaryVersion = { @@ -318,7 +320,8 @@ object Docs { if (apiLink.exists) apiLink.delete gitRemoveFiles(repo, IO.listFiles(versioned).toList, git, s) - if (!isBetaBranch) { + + if (isDevelopBranch) { gitRemoveFiles(repo, (repo * "*.html").get.toList, git, s) gitRemoveFiles( repo, @@ -338,7 +341,7 @@ object Docs { } yield (file, repo / target) IO.copy(ms) - if (isGenerateSiteMap.value && !isBetaBranch) { + if (isGenerateSiteMap.value && isDevelopBranch) { val (index, siteMaps) = SiteMap.generate( repo,