Skip to content

Commit 8df23b4

Browse files
committed
configuring publishing to packages
Signed-off-by: Stanchev Aleksandar <[email protected]>
1 parent 6340851 commit 8df23b4

File tree

6 files changed

+44
-42
lines changed

6 files changed

+44
-42
lines changed

.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ jobs:
2222

2323
- name: Build project
2424
run: ./build.sh
25+
26+
- name: Publish Snapshots
27+
run: ./sbt-publish.sh

.github/workflows/publish.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Publish to GitHub Packages
33
on:
44
push:
55
branches:
6+
- feature/
67
- release-*
78

89
jobs:
@@ -22,7 +23,7 @@ jobs:
2223
cache: sbt
2324

2425
- name: Publish
25-
run: sbt publish
26+
run: sbt clean +publish
2627
env:
2728
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
2829
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/bash
2-
rm ./bintray.sbt
32
sbt clean test

project/PublishSettings.scala

+34-32
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
import sbt._
22
import sbt.Keys._
3-
import bintray.{BintrayKeys, BintrayPlugin}
3+
import sbtrelease.ReleasePlugin.autoImport.releaseVcsSign
44

5-
object PublishSettings extends AutoPlugin with BintrayKeys {
5+
object PublishSettings extends AutoPlugin {
66
override def trigger = allRequirements
7-
override def requires = plugins.JvmPlugin && sbtrelease.ReleasePlugin && BintrayPlugin && ProjectSettings
7+
override def requires = plugins.JvmPlugin && sbtrelease.ReleasePlugin && ProjectSettings
88

9-
override def projectSettings = Seq(
9+
override def projectSettings = Seq(
1010
publishMavenStyle := true,
11+
publishTo := Some(
12+
if (isSnapshot.value)
13+
// Resolver.file("file", new File("target/snapshots"))
14+
"GitHub Package Registry Snapshots" at s"https://maven.pkg.github.com/alstanchev/${name.value}"
15+
else
16+
"GitHub Package Registry Releases" at s"https://maven.pkg.github.com/alstanchev/${name.value}"
17+
// "GitHub Packages" at s"https://maven.pkg.github.com/alstanchev/${name.value}"
18+
),
19+
credentials += Credentials(
20+
"GitHub Package Registry",
21+
"maven.pkg.github.com",
22+
sys.env.getOrElse("USER", ""),
23+
sys.env.getOrElse("PACKAGES_TOKEN", "")
24+
),
25+
releaseVcsSign := true,
1126
pomExtraSetting("pekko-persistence-inmemory"),
12-
homepageSetting("pekko-persistence-inmemory"),
13-
bintrayPackageLabelsSettings("inmemory"),
14-
bintrayPackageAttributesSettings("pekko-persistence-inmemory")
15-
)
16-
17-
def pomExtraSetting(name: String) = pomExtra :=
27+
homepageSetting("pekko-persistence-inmemory")
28+
)
29+
30+
def pomExtraSetting(name: String) = pomExtra :=
1831
<scm>
19-
<url>https://github.com/dnvriend/${name}</url>
20-
<connection>scm:git@github.com:alstanchev/${name}.git</connection>
21-
</scm>
22-
<developers>
32+
<url>https://github.com/dnvriend/${name}</url>
33+
<connection>scm:git@github.com:alstanchev/${name}.git</connection>
34+
</scm>
35+
<developers>
2336
<developer>
24-
<id>alstanchev</id>
25-
<name>Aleksandar Stanchev</name>
26-
<url>https://github.com/alstanchev</url>
37+
<id>alstanchev</id>
38+
<name>Aleksandar Stanchev</name>
39+
<url>https://github.com/alstanchev</url>
2740
</developer>
28-
</developers>
29-
30-
def homepageSetting(name: String) =
31-
homepage := Some(url(s"https://github.com/alstanchev/$name"))
32-
33-
def bintrayPackageLabelsSettings(labels: String*) =
34-
bintrayPackageLabels := Seq("pekko", "persistence") ++ labels
41+
</developers>
3542

36-
def bintrayPackageAttributesSettings(name: String) = {
37-
bintrayPackageAttributes ~= (_ ++ Map(
38-
"website_url" -> Seq(bintry.Attr.String(s"https://github.com/alstanchev/$name")),
39-
"github_repo" -> Seq(bintry.Attr.String(s"https://github.com/alstanchev/$name.git")),
40-
"issue_tracker_url" -> Seq(bintry.Attr.String(s"https://github.com/alstanchev/$name.git/issues/"))
41-
))
42-
}
43-
}
43+
def homepageSetting(name: String) =
44+
homepage := Some(url(s"https://github.com/alstanchev/$name"))
45+
}

sbt-coverage.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#
1+
#!/bin/bash
22
# Copyright 2016 Dennis Vriend
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,10 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
#!/bin/bash
17-
export CODACY_PROJECT_TOKEN=$INMEMORY_CODACY_TOKEN
18-
echo "project token: $CODACY_PROJECT_TOKEN"
16+
1917
sbt clean coverage test
2018
sbt coverageReport
21-
sbt coverageAggregate
22-
sbt codacyCoverage
19+
sbt coverageAggregate

sbt-publish.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#
1+
#!/bin/bash#
22
# Copyright 2016 Dennis Vriend
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,5 +13,5 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
#!/bin/bash
16+
1717
sbt clean +publish

0 commit comments

Comments
 (0)