From 8d0ffc1567ce1f91abe11006688afa99dd3a6e6a Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Tue, 30 Nov 2021 13:42:52 +0000 Subject: [PATCH 1/9] update contributing docs --- CONTRIBUTING.md | 111 ++++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 42 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d78d62e..707e42de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,66 +1,93 @@ # 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. +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. +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. + +--- + +### Generate a GPG key + +1. Generate a GPG key: + + ```bash + $ gpg --full-generate-key + ``` + +2. Kind: `RSA and RSA` +3. Key size: `4096` +4. Expiry: `2y` +5. Enter your name, email, comment and passphrase + +### Distribute your GPG key + +1. Get your public key: + + ```bash + $ gpg --list-keys + + pub rsa4096 2021-11-30 [SC] [expires: 2023-11-30] + CA925CD6C9E8D064FF05B4728190C4130ABA0F98 + ``` + +2. Send your GPG key: + + ```bash + $ gpg --keyserver keyserver.ubuntu.com --send-keys CA925CD6C9E8D064FF05B4728190C4130ABA0F98 + ``` + +### Signing the release + +1. Create a file at `~/.sbt/1.0/sonatype.sbt` + + ```sbt + credentials += Credentials("Sonatype Nexus Repository Manager", + "oss.sonatype.org", + "(Sonatype user name)", + "(Sonatype password)") + ``` + +### Releasing to Sonatype + +1. To release interactively, run `sbt release`. This will ask for the version to release, the next version, your PGP passphrase (for Sonatype) ## 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/) From a22b8b0b2314a42a7ad82ca23fd32cc08f15ef1b Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Fri, 14 Jan 2022 15:20:25 +0000 Subject: [PATCH 2/9] add sbt-ci-release --- project/plugins.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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") From 03d3481d15844542c483c368c5cc2fad0782b64b Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Fri, 14 Jan 2022 15:21:13 +0000 Subject: [PATCH 3/9] add sbt-ci-release build settings --- build.sbt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 8b1d8aea..ca6505c1 100644 --- a/build.sbt +++ b/build.sbt @@ -4,8 +4,20 @@ lazy val scala213 = "2.13.7" lazy val scala212 = "2.12.15" lazy val supportedScalaVersions = List(scala213, scala212) -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("https://github.com/sky-uk/kafka-topic-loader")) +licenses := List("BSD New" -> url("https://opensource.org/licenses/BSD-3-Clause")) +developers := List( + Developer( + "BiBCD", + "BiBCD", + "bibcd-jenkins-github-user@skyglobal.onmicrosoft.com", + url("https://github.com/sky-uk/kafka-topic-loader") + ) +) scalaVersion := scala213 crossScalaVersions := supportedScalaVersions @@ -46,10 +58,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") From 32e0730c9a5a06e2b880528c57f70b76acc86aaa Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Fri, 14 Jan 2022 15:21:31 +0000 Subject: [PATCH 4/9] update travis workflow to release on merge/tag push --- .travis.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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 From aa2476615c4c66a7653f82e2dd949fe4c532f2aa Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Sat, 15 Jan 2022 14:09:29 +0000 Subject: [PATCH 5/9] update contributing for sbt-ci-release usage --- CONTRIBUTING.md | 56 +++++++++---------------------------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 707e42de..bfceb0fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,56 +18,20 @@ The project is built and released for Scala versions 2.12 and 2.13. To compile a ## 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. +Merging a PR to master will create a snapshot release in the [Sonatype snapshot repository](https://s01.oss.sonatype.org/content/repositories/snapshots/uk/sky/). ---- +To create a new stable release, you must tag the head of master and push it to Github. -### Generate a GPG key +```bash +git checkout master +git pull origin master +git tag -a v$VERSION -m "v$VERSION" +git push origin v$VERSION +``` -1. Generate a GPG key: +> 💡 The tag **must** start with a `v` followed by the version, e.g. `v1.0.0` - ```bash - $ gpg --full-generate-key - ``` - -2. Kind: `RSA and RSA` -3. Key size: `4096` -4. Expiry: `2y` -5. Enter your name, email, comment and passphrase - -### Distribute your GPG key - -1. Get your public key: - - ```bash - $ gpg --list-keys - - pub rsa4096 2021-11-30 [SC] [expires: 2023-11-30] - CA925CD6C9E8D064FF05B4728190C4130ABA0F98 - ``` - -2. Send your GPG key: - - ```bash - $ gpg --keyserver keyserver.ubuntu.com --send-keys CA925CD6C9E8D064FF05B4728190C4130ABA0F98 - ``` - -### Signing the release - -1. Create a file at `~/.sbt/1.0/sonatype.sbt` - - ```sbt - credentials += Credentials("Sonatype Nexus Repository Manager", - "oss.sonatype.org", - "(Sonatype user name)", - "(Sonatype password)") - ``` - -### Releasing to Sonatype - -1. To release interactively, run `sbt release`. This will ask for the version to release, the next version, your PGP passphrase (for Sonatype) +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/). ## Contributor Code of Conduct From 824601a84f321bbd7b6f7982316bab2eef9764e8 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 17 Jan 2022 10:29:51 +0000 Subject: [PATCH 6/9] get dev email from environment --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index ca6505c1..c3e21db1 100644 --- a/build.sbt +++ b/build.sbt @@ -12,9 +12,9 @@ homepage := Some(url("https://github.com/sky-uk/kafka-topic-loader licenses := List("BSD New" -> url("https://opensource.org/licenses/BSD-3-Clause")) developers := List( Developer( - "BiBCD", - "BiBCD", - "bibcd-jenkins-github-user@skyglobal.onmicrosoft.com", + "Sky UK OSS", + "Sky UK OSS", + sys.env.getOrElse("SONATYPE_EMAIL", "https://github.com/sky-uk/kafka-topic-loader"), url("https://github.com/sky-uk/kafka-topic-loader") ) ) From a410eb7a94e454123e2aa6988695ca0415a570a7 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 17 Jan 2022 10:41:24 +0000 Subject: [PATCH 7/9] put github url in val --- build.sbt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index c3e21db1..b7127213 100644 --- a/build.sbt +++ b/build.sbt @@ -3,19 +3,20 @@ 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" name := "kafka-topic-loader" organization := "uk.sky" sonatypeCredentialHost := "s01.oss.sonatype.org" sonatypeRepository := "https://s01.oss.sonatype.org/service/local" -homepage := Some(url("https://github.com/sky-uk/kafka-topic-loader")) +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", "https://github.com/sky-uk/kafka-topic-loader"), - url("https://github.com/sky-uk/kafka-topic-loader") + sys.env.getOrElse("SONATYPE_EMAIL", scmUrl), + url(scmUrl) ) ) From fb94c8bb11f80f9876f4613f4be419ac1696f7e2 Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 17 Jan 2022 11:32:12 +0000 Subject: [PATCH 8/9] make gh release over pushing tag --- CONTRIBUTING.md | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfceb0fa..1781a161 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,18 +20,9 @@ The project is built and released for Scala versions 2.12 and 2.13. To compile a Merging a PR to master will create a snapshot release in the [Sonatype snapshot repository](https://s01.oss.sonatype.org/content/repositories/snapshots/uk/sky/). -To create a new stable release, you must tag the head of master and push it to Github. +To create a new stable release, create a GitHub release with the new version. 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/). -```bash -git checkout master -git pull origin master -git tag -a v$VERSION -m "v$VERSION" -git push origin v$VERSION -``` - -> 💡 The tag **must** start with a `v` followed by the version, e.g. `v1.0.0` - -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` ## Contributor Code of Conduct From 8b502475bda1a4aa31495ca8e415f96f2d7cccca Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Mon, 17 Jan 2022 11:47:39 +0000 Subject: [PATCH 9/9] clarify snapshot vs release steps --- CONTRIBUTING.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1781a161..ac9803ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,11 +18,19 @@ The project is built and released for Scala versions 2.12 and 2.13. To compile a ## Performing a release (for project maintainers) -Merging a PR to master will create a snapshot release in the [Sonatype snapshot repository](https://s01.oss.sonatype.org/content/repositories/snapshots/uk/sky/). +### Snapshot release -To create a new stable release, create a GitHub release with the new version. 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/). +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 release tag **must** start with a `v` followed by the version, e.g. `v1.0.0` +> 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