Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
63 changes: 63 additions & 0 deletions .github/workflows/publish-blog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Blog to GitHub Pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think GH Pages needs a fake .nojekyll file or something like that, for the workflow to run

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, I configured the GH pages to be deployed from GH actions. You can see the builds/actions kicked off on push but deploy fails because you can deploy only from master. So, if you are okay to merge this PR, you can see the pages live (once the push to master triggers the action).


on:
push:
branches: [ main, hkt ]
paths:
- 'src/main/resources/blog/**'
- 'src/main/scala/blog/**'
- '.github/workflows/publish-blog.yml'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'sbt'

- name: Install SBT
run: |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install -y sbt

- name: Build blog with SBT
run: sbt "runMain blog.BlogExpanded buildBlog"

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './src/main/resources/blog_out_v2'

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
199 changes: 14 additions & 185 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,190 +1,19 @@
# Created by https://www.toptal.com/developers/gitignore/api/scala,sbt,metals,intellij,java,maven
# Edit at https://www.toptal.com/developers/gitignore?templates=scala,sbt,metals,intellij,java,maven
.idea
.fleet
.bloop
.bsp
.vscode
.eclipse
.metals
.scala

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
target/
logs

### Java ###
# Compiled class file
*.class

# Log file
*.log
*.args
*.iml
metals.sbt

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Metals ###
.metals/
.bloop/
project/**/metals.sbt

### SBT ###
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control

dist/*
lib_managed/
src_managed/
project/boot/
project/plugins/project/
.history
.cache
.lib/

### SBT Patch ###
.bsp/

### Scala ###

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml

# End of https://www.toptal.com/developers/gitignore/api/scala,sbt,metals,intellij,java,maven

*.jpg
.idea/
.DS_Store
21 changes: 19 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
version = "3.5.9"
runner.dialect = scala3

align.preset = more
maxColumn = 120
runner.dialect = scala3
project.git = true
align.preset = more

align.tokens = [
"=>", "->", "<-", ":=", "//", "%", "%%", "%%%", "+=",
{
"code" = "=",
"owners" = [{ regex = ".*" }]
},
{
"code" = ":",
"owners" = [{ regex = ".*" }]
},
{
"code" = "=>"
"owners" = [{ regex = "(Importee.Rename|Case)" }]
}
]
29 changes: 14 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ version := "0.1"
scalaVersion := "3.3.4"

libraryDependencies ++= Seq(
"com.lihaoyi" %% "requests" % "0.9.0",
"com.lihaoyi" %% "upickle" % "4.1.0",
"com.lihaoyi" %% "os-lib" % "0.11.4",
"com.lihaoyi" %% "requests" % "0.9.0",
"com.lihaoyi" %% "upickle" % "4.1.0",
"com.lihaoyi" %% "os-lib" % "0.11.4",
"com.lihaoyi" %% "scalatags" % "0.13.1",
"com.lihaoyi" %% "cask" % "0.10.2",
"com.lihaoyi" %% "cask" % "0.10.2",
// Java libraries
// scraping
"org.jsoup" % "jsoup" % "1.19.1",
Expand All @@ -18,35 +18,34 @@ libraryDependencies ++= Seq(
// http apis
"org.asynchttpclient" % "async-http-client" % "3.0.2",
// mandelbrot
"org.openjfx" % "javafx-base" % "24.0.1",
"org.openjfx" % "javafx-base" % "24.0.1",
"org.openjfx" % "javafx-controls" % "24.0.1",
"org.openjfx" % "javafx-fxml" % "24.0.1",
"org.openjfx" % "javafx-swing" % "24.0.1",

"org.openjfx" % "javafx-fxml" % "24.0.1",
"org.openjfx" % "javafx-swing" % "24.0.1"
)

// blog build pipeline

// Custom tasks
lazy val blogResourceDir = settingKey[File]("Directory containing blog resources")
lazy val buildBlog = taskKey[Unit]("Build the blog")
lazy val runBlog = taskKey[Unit]("Run the blog on a local server")
lazy val watchBlog = taskKey[Unit]("Watch for changes and rebuild blog")
lazy val buildBlog = taskKey[Unit]("Build the blog")
lazy val runBlog = taskKey[Unit]("Run the blog on a local server")
lazy val watchBlog = taskKey[Unit]("Watch for changes and rebuild blog")

// Set resource directory
blogResourceDir := (Compile / resourceDirectory).value

// Build blog task
buildBlog := {
(Compile / runMain).toTask(" blog.Blog_V2 buildBlog").value
(Compile / runMain).toTask(" blog.BlogExpanded buildBlog").value
}

// Watch and reload task
watchBlog := {
val log = streams.value.log
val log = streams.value.log
val resourceDir = blogResourceDir.value
val markdownDir = resourceDir / "blog"
val state = Keys.state.value // Get the current state
val state = Keys.state.value // Get the current state

log.info(s"Watching for changes in $markdownDir")

Expand All @@ -72,4 +71,4 @@ runBlog := {

log.info("Starting blog server...")
(Compile / runMain).toTask(" blog.RunServer").value
}
}
Binary file removed src/main/resources/.DS_Store
Binary file not shown.
Loading
Loading