-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Publish Artifact on Release | ||
on: | ||
release: | ||
types: [ created ] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'sbt' | ||
- name: Publish | ||
run: sbt publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//ThisBuild / organization := "io.github.rafafrdz" | ||
//ThisBuild / organizationName := "rafafrdz" | ||
//ThisBuild / organizationHomepage := Some(url("https://github.com/rafafrdz")) | ||
// | ||
//ThisBuild / scmInfo := Some( | ||
// ScmInfo( | ||
// url("https://github.com/rafafrdz/criterial-dsl"), | ||
// "scm:[email protected]/criterial-dsl.git" | ||
// ) | ||
//) | ||
// | ||
//ThisBuild / developers := List( | ||
// Developer( | ||
// id = "rafafrdz", | ||
// name = "Rafael Fernández Ortiz", | ||
// email = "[email protected]", | ||
// url = url("https://github.com/rafafrdz") | ||
// ) | ||
//) | ||
// | ||
//ThisBuild / description := "A simple DSL to create criterias for filtering data in Scala." | ||
//ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")) | ||
//ThisBuild / homepage := Some(url("https://github.com/rafafrdz/criterial-dsl")) | ||
// | ||
//// Remove all additional repository other than Maven Central from POM | ||
//ThisBuild / pomIncludeRepository := { _ => false } | ||
// | ||
//ThisBuild / publishTo := { | ||
// val registry = "https://maven.pkg.github.com/rafafrdz/criterial-dsl" | ||
// Option("GitHub Package Registry" at registry) | ||
//} | ||
// | ||
//ThisBuild / publishMavenStyle := true | ||
// | ||
//ThisBuild / versionScheme := Some("early-semver") | ||
|
||
val tagWithQualifier: String => String => String = | ||
qualifier => tagVersion => s"%s.%s.%s-${qualifier}%s".format(tagVersion.split("\\."): _*) | ||
|
||
val tagAlpha: String => String = tagWithQualifier("a") | ||
val tagBeta: String => String = tagWithQualifier("b") | ||
val tagMilestone: String => String = tagWithQualifier("m") | ||
val tagRC: String => String = tagWithQualifier("rc") | ||
|
||
val defaultVersion: String = "0.0.0-a0" | ||
val versionFromTag: String = sys.env | ||
.get("GITHUB_REF_TYPE") | ||
.filter(_ == "tag") | ||
.flatMap(_ => sys.env.get("GITHUB_REF_NAME")) | ||
.flatMap { t => | ||
t.headOption.map { | ||
case 'a' => tagAlpha(t.tail) // Alpha build, a1.2.3.4 | ||
case 'b' => tagBeta(t.tail) // Beta build, b1.2.3.4 | ||
case 'm' => tagMilestone(t.tail) // Milestone build, m1.2.3.4 | ||
case 'r' => tagRC(t.tail) // RC build, r1.2.3.4 | ||
case 'v' => t.tail // Production build, should be v1.2.3 | ||
case _ => defaultVersion | ||
} | ||
} | ||
.getOrElse(defaultVersion) | ||
|
||
ThisBuild / organization := "io.github.rafafrdz" | ||
ThisBuild / organizationName := "rafafrdz" | ||
ThisBuild / organizationHomepage := Some(url("https://github.com/rafafrdz")) | ||
ThisBuild / version := versionFromTag | ||
ThisBuild / publish / skip := true | ||
ThisBuild / publishMavenStyle := true | ||
ThisBuild / versionScheme := Some("early-semver") | ||
ThisBuild / publishTo := Some( | ||
"GitHub Package Registry " at "https://maven.pkg.github.com/rafafrdz/criterial-dsl" | ||
) | ||
ThisBuild / credentials += Credentials( | ||
"GitHub Package Registry", | ||
"maven.pkg.github.com", | ||
"rafafrdz", | ||
sys.env.getOrElse("GITHUB_TOKEN", "") | ||
) |