Skip to content

Commit 0b94b6c

Browse files
authored
#26 library release using sbt-ci-release plugin (#27)
#26 library release using sbt-ci-release plugin
1 parent 9b08219 commit 0b94b6c

File tree

8 files changed

+113
-22
lines changed

8 files changed

+113
-22
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
* @Zejnilovic @dk1844 @benedeki @AdrianOlosutean
1+
* @Zejnilovic
2+
* @dk1844
3+
* @benedeki
4+
* @lsulak

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Copyright 2022 ABSA Group Limited
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Release
18+
on:
19+
workflow_dispatch:
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/[email protected]
26+
with:
27+
fetch-depth: 0
28+
- uses: olafurpg/setup-scala@v13
29+
- run: sbt ci-release
30+
env:
31+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
32+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
33+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
34+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Spark Data Standardization Library
22

3+
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
4+
[![Release](https://github.com/AbsaOSS/spark-data-standardization/actions/workflows/release.yml/badge.svg)](https://github.com/AbsaOSS/spark-data-standardization/actions/workflows/release.yml)
5+
36
- Dataframe in
47
- Standardized Dataframe out
58

@@ -34,3 +37,7 @@ Spark and Scala compatibility
3437
>| | Scala 2.11 | Scala 2.12 |
3538
>|---|---|---|
3639
>|Spark| 2.4.X | 3.2.1 |
40+
41+
## How to Release
42+
43+
Please see [this file](RELEASE.md) for more details.

RELEASE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Release
2+
3+
Releases of this library are currently handled by [sbt-ci-release](https://github.com/sbt/sbt-ci-release).
4+
Please see its documentation for more details about how it works if you are interested to know more.
5+
6+
The actual deployments are triggered manually by the maintainers of this repository, using `workflow_dispatch` event
7+
trigger.
8+
9+
Once changes from a PR were reviewed and merged into the master branch, follow these steps:
10+
1. Create a new Git Tag and push it to the repository, to the master branch. For example,
11+
if you want to release a version 0.4.0 (note that we are using [Semantic Versioning](https://semver.org/)):
12+
13+
```shell
14+
git tag -a v0.4.0 -m "v0.4.0"
15+
git push origin v0.4.0
16+
```
17+
18+
2. In GitHub UI, go to the repository's **Actions** -> **Release** -> **Run workflow**, and under **Use workflow from**
19+
use **Tags** and find the tag you created in the previous step.
20+
21+
> **Important note**: don't run the workflow against the master branch, but against the tag.
22+
> `sbt-ci-release` plugin won't be able to correctly find tag, and it will think that you are trying
23+
> to do a snapshot release, not an actual release that should be synchronized with Maven Central.

build.sbt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ import sys.process._
1717

1818
ThisBuild / name := "spark-data-standardization"
1919
ThisBuild / organization := "za.co.absa"
20-
ThisBuild / version := "0.0.1-SNAPSHOT"
2120

2221
lazy val scala211 = "2.11.12"
2322
lazy val scala212 = "2.12.12"
2423

2524
ThisBuild / crossScalaVersions := Seq(scala211, scala212)
2625
ThisBuild / scalaVersion := scala211
2726

27+
ThisBuild / versionScheme := Some("early-semver")
28+
2829
def sparkVersion(scalaVersion: String): String = if (scalaVersion==scala212) "3.2.1" else "2.4.7"
2930

3031
def sparkFastTestsVersion(scalaVersion: String): String = if (scalaVersion == scala212) "1.1.0" else "0.23.0"
@@ -60,10 +61,5 @@ lazy val baseBranchName = (
6061

6162
scalafmtFilter.withRank(KeyRanks.Invisible) := s"diff-ref=${baseBranchName}"
6263

63-
// licenceHeader check:
64-
ThisBuild / organizationName := "ABSA Group Limited"
65-
ThisBuild / startYear := Some(2021)
66-
ThisBuild / licenses += "Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")
67-
6864
// linting
6965
Global / excludeLintKeys += ThisBuild / name // will be used in publish, todo #3 - confirm if lint ignore is still needed

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.5.5
1+
sbt.version=1.6.2

project/plugins.sbt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1+
/*
2+
* Copyright 2022 ABSA Group Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
18+
119
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
20+
221
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.5")

publish.sbt

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
// to successfully publish to Sonatype OSS (using sbt publishSigned), setup outline at
18-
// https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html is expected
19-
2017
ThisBuild / organizationHomepage := Some(url("https://www.absa.africa"))
2118
ThisBuild / scmInfo := Some(
2219
ScmInfo(
23-
browseUrl = url("http://github.com/AbsaOSS/spark-data-standardization/tree/master"),
20+
browseUrl = url("https://github.com/AbsaOSS/spark-data-standardization/tree/master"),
2421
connection = "scm:git:git://github.com/AbsaOSS/spark-data-standardization.git",
2522
devConnection = "scm:git:ssh://github.com/AbsaOSS/spark-data-standardization.git"
2623
)
@@ -38,19 +35,31 @@ ThisBuild / developers := List(
3835
name = "Daniel Kavan",
3936
email = "[email protected]",
4037
url = url("https://github.com/dk1844")
38+
),
39+
Developer(
40+
id = "benedeki",
41+
name = "David Benedeki",
42+
email = "[email protected]",
43+
url = url("https://github.com/benedeki")
44+
),
45+
Developer(
46+
id = "AdrianOlosutean",
47+
name = "Adrian Olosutean",
48+
email = "[email protected]",
49+
url = url("https://github.com/AdrianOlosutean")
50+
),
51+
Developer(
52+
id = "lsulak",
53+
name = "Ladislav Sulak",
54+
email = "[email protected]",
55+
url = url("https://github.com/lsulak")
4156
)
4257
)
4358

4459
ThisBuild / homepage := Some(url("https://github.com/AbsaOSS/spark-data-standardization"))
4560
ThisBuild / description := "Data Standardization library (originally part of the Enceladus project)"
4661

47-
ThisBuild / pomIncludeRepository := { _ => false }
48-
ThisBuild / publishTo := {
49-
val nexus = "https://oss.sonatype.org/"
50-
if (isSnapshot.value) {
51-
Some("snapshots" at s"${nexus}content/repositories/snapshots")
52-
} else {
53-
Some("releases" at s"${nexus}service/local/staging/deploy/maven2")
54-
}
55-
}
56-
ThisBuild / publishMavenStyle := true
62+
// licenceHeader check:
63+
ThisBuild / organizationName := "ABSA Group Limited"
64+
ThisBuild / startYear := Some(2021)
65+
ThisBuild / licenses += "Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")

0 commit comments

Comments
 (0)