Skip to content

Commit

Permalink
Deploy by GA
Browse files Browse the repository at this point in the history
  • Loading branch information
malliina committed Sep 29, 2024
1 parent 7d7c26f commit d1503be
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
java-version: 17
cache: sbt
- name: Compile
run: sbt Test/compile
run: sbt "set scalaJSStage in Global := FullOptStage" Test/compile
- name: Build deb packages
run: |
sudo apt-get install -y lintian
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy

on: push

jobs:
build:
name: Build
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
cache: sbt
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/ga.key
chmod 600 ~/.ssh/ga.key
cat >>~/.ssh/config <<END
Host server
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/ga.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
- name: Compile
run: sbt "set scalaJSStage in Global := FullOptStage" Test/compile
- name: Build deb packages
run: |
sudo apt-get install -y lintian
sbt "set scalaJSStage in Global := FullOptStage" musicpimp/Debian/packageAndCopy pimpcloud/Debian/packageAndCopy
- name: Deploy pimpcloud
run: |
scp pimpcloud/target/pimpcloud.deb server:/home/mle/pimpcloud.deb
ssh server 'sudo dpkg --force-confold -i /home/mle/pimpcloud.deb'
17 changes: 14 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ val httpGroup = "org.apache.httpcomponents"

ThisBuild / scalaVersion := "2.13.15"

val packageAndCopy = taskKey[File]("Copies packaged file for convenience")

val utilAudio = Project("util-audio", file("util-audio"))
.enablePlugins(MavenCentralPlugin)
.settings(
Expand Down Expand Up @@ -384,8 +386,8 @@ lazy val pimpcloudSettings =
)

lazy val pimpcloudLinuxSettings = Seq(
Linux / httpPort := Option("disabled"),
Linux / httpsPort := Option("8458"),
Linux / httpPort := Option("8458"),
Linux / httpsPort := Option("disabled"),
maintainer := "Michael Skogberg <[email protected]>",
manufacturer := "Skogberg Labs",
mainClass := Some("com.malliina.pimpcloud.Starter"),
Expand Down Expand Up @@ -447,7 +449,16 @@ def serverSettings = LinusPlugin.playSettings ++ Seq(
"org.slf4j" % "slf4j-api" % "1.7.30",
"org.scalameta" %% "munit" % munitVersion % Test
),
testFrameworks += new TestFramework("munit.Framework")
Debian / packageAndCopy := {
val deb = (Debian / packageBin).value
val artifact = (Debian / packageBin).value
val destName = (Linux / name).value
val dest = target.value / s"$destName.deb"
sbt.IO.copyFile(artifact, dest)
streams.value.log.info(s"Copied '$artifact' to '$dest'.")
dest
},
Debian / packageAndCopy := (Debian / packageAndCopy).dependsOn(Debian / packageBin).value
)

def libSettings = Seq(
Expand Down

0 comments on commit d1503be

Please sign in to comment.