Skip to content

Commit 6f7befa

Browse files
committed
Updated build scripts
1 parent d6af75d commit 6f7befa

File tree

4 files changed

+100
-4
lines changed

4 files changed

+100
-4
lines changed

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: [HexagonNico]
2+
ko_fi: HexagonNico
3+
custom: ["https://paypal.me/hexagonnico"]

.github/workflows/publish.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
jobs:
8+
test:
9+
uses: ./.github/workflows/test.yml
10+
publish:
11+
needs: test
12+
environment: production
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
- name: Setup JDK
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: oracle
21+
java-version: 17
22+
- name: Configure GPG Key
23+
env:
24+
GPG_KEY: ${{ secrets.GPG_KEY }}
25+
run: |
26+
echo -n "$GPG_KEY" | base64 --decode | gpg --import
27+
- name: Prepare environment
28+
env:
29+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
31+
run: |
32+
mkdir -p ~/.sbt/1.0
33+
touch ~/.sbt/1.0/sonatype.sbt
34+
echo "credentials += Credentials(Path.userHome / \".sbt\" / \"sonatype_credentials\")" > ~/.sbt/1.0/sonatype.sbt
35+
touch ~/.sbt/sonatype_credentials
36+
echo "realm=Sonatype Nexus Repository Manager" > ~/.sbt/sonatype_credentials
37+
echo "host=s01.oss.sonatype.org" >> ~/.sbt/sonatype_credentials
38+
echo "user=$SONATYPE_USERNAME" >> ~/.sbt/sonatype_credentials
39+
echo "password=$SONATYPE_PASSWORD" >> ~/.sbt/sonatype_credentials
40+
mkdir ~/.sbt/1.0/plugins
41+
touch ~/.sbt/1.0/plugins/gpg.sbt
42+
echo "addSbtPlugin(\"com.github.sbt\" % \"sbt-pgp\" % \"2.1.2\")" > ~/.sbt/1.0/plugins/gpg.sbt
43+
- name: Deploy
44+
run: sbt publishSigned
45+
- name: Message
46+
run: echo "Staging repository created at https://s01.oss.sonatype.org/#stagingRepositories"

.github/workflows/test.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Test
2+
on: [push, pull_request, workflow_call]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v3
9+
- name: Setup JDK
10+
uses: actions/setup-java@v3
11+
with:
12+
distribution: oracle
13+
java-version: 17
14+
- name: Build and Test
15+
run: sbt compile test

build.sbt

+36-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Project info
22
name := "ColorLib"
3+
homepage := Some(url("https://github.com/ScalaMath/ColorLib"))
34
organization := "io.github.scalamath"
5+
organizationName := "ScalaMath"
6+
organizationHomepage := Some(url("https://github.com/ScalaMath"))
47
version := "1.0"
58
description := "A Scala library for color math"
69
// Project scala version
@@ -13,8 +16,37 @@ libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % Test
1316
// Junit test dependency
1417
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test
1518

16-
// Needed to run Java Junit tests
17-
crossPaths := true
18-
1919
// Show deprecation warnings
20-
scalacOptions ++= Seq("-unchecked", "-deprecation")
20+
scalacOptions ++= Seq("-unchecked", "-deprecation")
21+
22+
// Publish info
23+
scmInfo := Some(
24+
ScmInfo(
25+
url("https://github.com/ScalaMath/ColorLib"),
26+
"scm:[email protected]:ScalaMath/ColorLib.git"
27+
)
28+
)
29+
30+
// Developer info
31+
developers := List(
32+
Developer(
33+
id = "HexagonNico",
34+
name = "Nicholas Amigoni",
35+
email = "[email protected]",
36+
url = url("https://hexagonnico.github.io")
37+
)
38+
)
39+
40+
// Project license
41+
licenses := List(
42+
"Apache 2" -> new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")
43+
)
44+
45+
// Maven publishing
46+
pomIncludeRepository := { _ => false }
47+
publishTo := {
48+
val nexus = "https://s01.oss.sonatype.org/"
49+
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
50+
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
51+
}
52+
publishMavenStyle := true

0 commit comments

Comments
 (0)