Skip to content

Commit

Permalink
Prep for branching off 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Feb 17, 2024
1 parent d3f59ad commit 888b1f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
19 changes: 11 additions & 8 deletions project/Docs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 888b1f4

Please sign in to comment.