diff --git a/.travis.yml b/.travis.yml index 68e3bf16..60b4f0b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +# https://www.scala-sbt.org/1.x/docs/Travis-CI-with-sbt.html + language: scala scala: @@ -10,16 +12,30 @@ branches: only: - master -# https://www.scala-sbt.org/1.x/docs/Travis-CI-with-sbt.html +before_install: + - git fetch --tags + +stages: + - name: test + - name: release + if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork + cache: directories: - $HOME/.cache/coursier - $HOME/.ivy2/cache - $HOME/.sbt + before_cache: - rm -fv $HOME/.ivy2/.sbt.ivy.lock - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete - find $HOME/.sbt -name "*.lock" -print -delete -script: - - sbt ciBuild +jobs: + include: + # stage="test" if no stage is specified + - name: ciBuild + script: sbt ciBuild + # run ci-release only if previous stages passed + - stage: release + script: sbt ci-release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d78d62e..ac9803ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,66 +1,56 @@ # Contributing -Contributions are welcomed! +Contributions are welcomed! -When contributing to this repository, please first discuss the change you wish to make via GitHub -issue before making a change. This saves everyone from wasted effort in the event that the proposed -changes need some adjustment before they are ready for submission. +When contributing to this repository, please first discuss the change you wish to make via GitHub issue before making a change. This saves everyone from wasted effort in the event that the proposed changes need some adjustment before they are ready for submission. ## Pull Request Process 1. Fork the repo, push your commits to a branch of your fork, open the PR. 2. Make sure you update the README.md where relevant. -3. Project maintainers will squash-merge Pull Requests once they are happy. There may be one or more - cycles of feedback on the PR before they are satisfied. +3. Project maintainers will squash-merge Pull Requests once they are happy. There may be one or more cycles of feedback on the PR before they are satisfied. ## Build and run tests locally The software is written in [Scala](https://scala-lang.org/) and is built with [SBT](http://www.scala-sbt.org/). -The project is built and released for Scala versions 2.12 and 2.13. -To compile and test both versions run `sbt +test`. +The project is built and released for Scala versions 2.12 and 2.13. To compile and test both versions run `sbt +test`. ## Performing a release (for project maintainers) -1. Follow the [sbt-bintray publishing guidelines](https://github.com/sbt/sbt-bintray#publishing) to ensure you are - authenticated with Bintray. Note that you need to be a member of the `sky-uk` Bintray organization. -2. Run `sbt release` to perform the release of the binaries to Bintray. -3. Check you are happy with the draft publication of the new version [here](https://bintray.com/sky-uk/oss-maven/kafka-topic-loader) - and, if so, run `sbt bintrayRelease` to make the new version publicly accessible. +### Snapshot release + +1. Merging a PR to master will trigger the `release` step of the [travis workflow](./.travis.yml) and create a snapshot release in the [Sonatype snapshot repository](https://s01.oss.sonatype.org/content/repositories/snapshots/uk/sky/). + +> the `sbt-ci-release` plugin detects it is a snapshot release uses [sbt-dynver](https://github.com/dwijnand/sbt-dynver) versioning. + +### Stable release + +1. Create a GitHub release with the new version and tag following [semver.org](https://semver.org/). +2. Update the release notes according to recent changes. You can click 'Auto-generate release notes' when creating the release. +3. Publish the release. This will trigger the `release` stage of the [travis workflow](./.travis.yml) and push the image to the [Sonatype release repository](https://s01.oss.sonatype.org/content/repositories/releases/uk/sky/). + +> 💡 The release tag **must** start with a `v` followed by the version, e.g. `v1.0.0` for sbt-ci-release to work ## Contributor Code of Conduct -As contributors and maintainers of this project, and in the interest of fostering an open and -welcoming community, we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, submitting pull requests or patches, and other -activities. +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. -We are committed to making participation in this project a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, sexual orientation, -disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, such as physical or electronic addresses, without explicit - permission -* Other unethical or unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, -code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By -adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. Project maintainers who do not -follow or enforce the Code of Conduct may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces when an individual is -representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an -issue or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), -version 1.2.0, available at -[http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) +- The use of sexualized language or imagery +- Personal attacks +- Trolling or insulting/derogatory comments +- Public or private harassment +- Publishing other's private information, such as physical or electronic addresses, without explicit permission +- Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/build.sbt b/build.sbt index 8b1d8aea..b7127213 100644 --- a/build.sbt +++ b/build.sbt @@ -3,9 +3,22 @@ import Dependencies.all lazy val scala213 = "2.13.7" lazy val scala212 = "2.12.15" lazy val supportedScalaVersions = List(scala213, scala212) +lazy val scmUrl = "https://github.com/sky-uk/kafka-topic-loader" -organization := "com.sky" -name := "kafka-topic-loader" +name := "kafka-topic-loader" +organization := "uk.sky" +sonatypeCredentialHost := "s01.oss.sonatype.org" +sonatypeRepository := "https://s01.oss.sonatype.org/service/local" +homepage := Some(url(scmUrl)) +licenses := List("BSD New" -> url("https://opensource.org/licenses/BSD-3-Clause")) +developers := List( + Developer( + "Sky UK OSS", + "Sky UK OSS", + sys.env.getOrElse("SONATYPE_EMAIL", scmUrl), + url(scmUrl) + ) +) scalaVersion := scala213 crossScalaVersions := supportedScalaVersions @@ -46,10 +59,6 @@ Test / fork := true Global / onChangedBuildSource := ReloadOnSourceChanges -releaseCrossBuild := true - -licenses += ("BSD New", url("https://opensource.org/licenses/BSD-3-Clause")) - libraryDependencies ++= all addCommandAlias("checkFix", "scalafixAll --check OrganizeImports; scalafixAll --check") diff --git a/project/plugins.sbt b/project/plugins.sbt index fa67bf2e..a96f9b7e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.33") -addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.10") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.33") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")