Skip to content

Commit

Permalink
Updated build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
HexagonNico committed Apr 18, 2024
1 parent d6af75d commit 6f7befa
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [HexagonNico]
ko_fi: HexagonNico
custom: ["https://paypal.me/hexagonnico"]
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
publish:
needs: test
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: oracle
java-version: 17
- name: Configure GPG Key
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
run: |
echo -n "$GPG_KEY" | base64 --decode | gpg --import
- name: Prepare environment
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
mkdir -p ~/.sbt/1.0
touch ~/.sbt/1.0/sonatype.sbt
echo "credentials += Credentials(Path.userHome / \".sbt\" / \"sonatype_credentials\")" > ~/.sbt/1.0/sonatype.sbt
touch ~/.sbt/sonatype_credentials
echo "realm=Sonatype Nexus Repository Manager" > ~/.sbt/sonatype_credentials
echo "host=s01.oss.sonatype.org" >> ~/.sbt/sonatype_credentials
echo "user=$SONATYPE_USERNAME" >> ~/.sbt/sonatype_credentials
echo "password=$SONATYPE_PASSWORD" >> ~/.sbt/sonatype_credentials
mkdir ~/.sbt/1.0/plugins
touch ~/.sbt/1.0/plugins/gpg.sbt
echo "addSbtPlugin(\"com.github.sbt\" % \"sbt-pgp\" % \"2.1.2\")" > ~/.sbt/1.0/plugins/gpg.sbt
- name: Deploy
run: sbt publishSigned
- name: Message
run: echo "Staging repository created at https://s01.oss.sonatype.org/#stagingRepositories"
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test
on: [push, pull_request, workflow_call]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: oracle
java-version: 17
- name: Build and Test
run: sbt compile test
40 changes: 36 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Project info
name := "ColorLib"
homepage := Some(url("https://github.com/ScalaMath/ColorLib"))
organization := "io.github.scalamath"
organizationName := "ScalaMath"
organizationHomepage := Some(url("https://github.com/ScalaMath"))
version := "1.0"
description := "A Scala library for color math"
// Project scala version
Expand All @@ -13,8 +16,37 @@ libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % Test
// Junit test dependency
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test

// Needed to run Java Junit tests
crossPaths := true

// Show deprecation warnings
scalacOptions ++= Seq("-unchecked", "-deprecation")
scalacOptions ++= Seq("-unchecked", "-deprecation")

// Publish info
scmInfo := Some(
ScmInfo(
url("https://github.com/ScalaMath/ColorLib"),
"scm:git@github.com:ScalaMath/ColorLib.git"
)
)

// Developer info
developers := List(
Developer(
id = "HexagonNico",
name = "Nicholas Amigoni",
email = "nico.hex6@gmail.com",
url = url("https://hexagonnico.github.io")
)
)

// Project license
licenses := List(
"Apache 2" -> new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")
)

// Maven publishing
pomIncludeRepository := { _ => false }
publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishMavenStyle := true

0 comments on commit 6f7befa

Please sign in to comment.