Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sbt/sbt-ci-release
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.9.2
Choose a base ref
...
head repository: sbt/sbt-ci-release
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.9.3
Choose a head ref

Commits on Dec 19, 2024

  1. Sonatype requires user token now

    SethTisue committed Dec 19, 2024
    Copy the full SHA
    8979ec9 View commit details
  2. remove Travis-CI instructions

    SethTisue committed Dec 19, 2024
    Copy the full SHA
    46b1e8f View commit details

Commits on Dec 20, 2024

  1. Update readme.md

    Co-authored-by: eugene yokota <eed3si9n@gmail.com>
    SethTisue and eed3si9n authored Dec 20, 2024
    Copy the full SHA
    d531e3a View commit details
  2. Merge pull request #340 from SethTisue/token-now-required

    Sonatype requires user token now
    eed3si9n authored Dec 20, 2024
    Copy the full SHA
    ae9320c View commit details

Commits on Dec 25, 2024

  1. Update sbt, scripted-plugin to 1.10.7

    scala-steward committed Dec 25, 2024
    Copy the full SHA
    20a0c6e View commit details

Commits on Dec 26, 2024

  1. Merge pull request #342 from scala-steward/update/sbt-1.10.7

    eed3si9n authored Dec 26, 2024
    Copy the full SHA
    1cf85d9 View commit details

Commits on Jan 7, 2025

  1. Merge pull request #341 from SethTisue/remove-travis-instructions

    eed3si9n authored Jan 7, 2025
    Copy the full SHA
    30f2a17 View commit details

Commits on Jan 19, 2025

  1. Update sbt-scalafmt to 2.5.4

    scala-steward committed Jan 19, 2025
    Copy the full SHA
    193a964 View commit details
  2. Update scalafmt-core to 3.8.5

    scala-steward committed Jan 19, 2025
    Copy the full SHA
    5107260 View commit details
  3. Merge pull request #347 from scala-steward/update/scalafmt-core-3.8.5

    Update scalafmt-core to 3.8.5
    eed3si9n authored Jan 19, 2025
    Copy the full SHA
    e8f7812 View commit details
  4. Merge pull request #346 from scala-steward/update/sbt-scalafmt-2.5.4

    Update sbt-scalafmt to 2.5.4
    eed3si9n authored Jan 19, 2025
    Copy the full SHA
    5473b64 View commit details

Commits on Jan 25, 2025

  1. Update scalafmt-core to 3.8.6

    scala-steward committed Jan 25, 2025
    Copy the full SHA
    22c83e2 View commit details
  2. Merge pull request #348 from scala-steward/update/scalafmt-core-3.8.6

    eed3si9n authored Jan 25, 2025
    Copy the full SHA
    1613575 View commit details

Commits on Feb 4, 2025

  1. Update scala3-library to 3.3.5

    scala-steward committed Feb 4, 2025
    Copy the full SHA
    b49c149 View commit details
  2. Merge pull request #349 from scala-steward/update/scala3-library-3.3.5

    Update scala3-library to 3.3.5
    eed3si9n authored Feb 4, 2025
    Copy the full SHA
    705555d View commit details

Commits on Feb 11, 2025

  1. Remove coursier and almond from adopters

    Both projects switched to Mill quite some time ago, so they don't use sbt-ci-release any more
    alexarchambault authored Feb 11, 2025
    Copy the full SHA
    aa2194b View commit details

Commits on Feb 12, 2025

  1. Merge pull request #350 from sbt/alexarchambault-patch-1

    Remove coursier and almond from adopters
    eed3si9n authored Feb 12, 2025
    Copy the full SHA
    7e121d2 View commit details

Commits on Feb 17, 2025

  1. Update scalafmt-core to 3.9.0

    scala-steward committed Feb 17, 2025
    Copy the full SHA
    6b4d95c View commit details
  2. Merge pull request #351 from scala-steward/update/scalafmt-core-3.9.0

    Update scalafmt-core to 3.9.0
    eed3si9n authored Feb 17, 2025
    Copy the full SHA
    d35b3b8 View commit details

Commits on Feb 23, 2025

  1. Update scalafmt-core to 3.9.1

    scala-steward committed Feb 23, 2025
    Copy the full SHA
    30cfae5 View commit details

Commits on Feb 24, 2025

  1. Merge pull request #352 from scala-steward/update/scalafmt-core-3.9.1

    Update scalafmt-core to 3.9.1
    eed3si9n authored Feb 24, 2025
    Copy the full SHA
    65dd58f View commit details

Commits on Mar 11, 2025

  1. Be more dynver-aware while dropping tag commands

    **Problem**
    Currently the dropBackPubCommand is too aggressive in dropping
    everything after at-sign, which ends up dropping dynver suffixes.
    
    **Solution**
    This implements dynver-aware dropping.
    eed3si9n committed Mar 11, 2025
    Copy the full SHA
    f288743 View commit details
  2. Merge pull request #358 from sbt/wip/dynver-awareness

    eed3si9n authored Mar 11, 2025
    Copy the full SHA
    8f89fa5 View commit details
Showing with 40 additions and 118 deletions.
  1. +1 −1 .scalafmt.conf
  2. +1 −1 build.sbt
  3. +13 −1 plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala
  4. +1 −1 project/build.properties
  5. +1 −1 project/plugins.sbt
  6. +23 −113 readme.md
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.9.1"
project.git = true
project.layout = StandardConvention
runner.dialect = scala212source3
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lazy val scala212 = "2.12.20"
lazy val scala3 = "3.3.4"
lazy val scala3 = "3.3.5"

inThisBuild(
List(
14 changes: 13 additions & 1 deletion plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala
Original file line number Diff line number Diff line change
@@ -143,7 +143,19 @@ object CiReleasePlugin extends AutoPlugin {
case None => backPubVersionToCommand(v)
}
},
version ~= dropBackPubCommand
version := {
val v = version.value
dynverGitDescribeOutput.value match {
case Some(gitDescribe) =>
val tagVersion = gitDescribe.ref.dropPrefix
if (gitDescribe.isCleanAfterTag) {
dropBackPubCommand(v)
} else if (v.startsWith(tagVersion)) {
dropBackPubCommand(tagVersion) + v.drop(tagVersion.size)
} else v
case _ => v
}
}
)

override lazy val globalSettings: Seq[Def.Setting[_]] = List(
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.6
sbt.version=1.10.7
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@ addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
136 changes: 23 additions & 113 deletions readme.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
![CI](https://github.com/sbt/sbt-ci-release/workflows/CI/badge.svg)

This is an sbt plugin to help automate releases to Sonatype and Maven Central
from GitHub Actions.
from CI environments such as GitHub Actions.

- git tag pushes are published as regular releases to Maven Central
- merge into main commits are published as -SNAPSHOT with a unique version
@@ -22,8 +22,6 @@ Let's get started!
- [sbt](#sbt)
- [GPG](#gpg)
- [Secrets](#secrets)
- [GitHub Actions](#github-actions)
- [Travis](#travis)
- [Git](#git)
- [FAQ](#faq)
- [How do I publish to Sonatype Central?](#how-do-i-publish-to-sonatype-central)
@@ -32,7 +30,7 @@ Let's get started!
- [How do I publish cross-built Scala.js projects?](#how-do-i-publish-cross-built-scalajs-projects)
- [Can I depend on Maven Central releases immediately?](#can-i-depend-on-maven-central-releases-immediately)
- [How do I depend on the SNAPSHOT releases?](#how-do-i-depend-on-the-snapshot-releases)
- [What about other CIs environments than Travis?](#what-about-other-cis-environments-than-travis)
- [What about other CI environments?](#what-about-other-ci-environments)
- [Does sbt-ci-release work for sbt 0.13?](#does-sbt-ci-release-work-for-sbt-013)
- [How do I publish sbt plugins?](#how-do-i-publish-sbt-plugins)
- [java.io.IOException: secret key ring doesn't start with secret key tag: tag 0xffffffff](#javaioioexception-secret-key-ring-doesnt-start-with-secret-key-tag-tag-0xffffffff)
@@ -63,10 +61,9 @@ Hi, I would like to publish under the groupId: io.github.sbt.
It's my GitHub account https://github.com/sbt/
```

### Optional: create user tokens

If you prefer not to save your actual username and password in GitHub Actions
settings below, generate your user tokens:
Sonatype no longer allows using your actual username and password to
authenticate during publishing. Instead, you must use the name and password
from your "user token".

- login to https://s01.oss.sonatype.org/ (or https://oss.sonatype.org/ if your
Sonatype account was created before February 2021),
@@ -144,7 +141,7 @@ gpg --gen-key
"sbt-ci-release bot".
- For email, use your own email address
- For passphrase, generate a random password with a password manager. This will be the
environment variables PGP_PASSPHRASE in your CI. Take note of `PGP_PASSPHRASE`.
environment variables `PGP_PASSPHRASE` in your CI config. Take note of `PGP_PASSPHRASE`.

At the end you'll see output like this

@@ -203,26 +200,17 @@ gpg --keyserver hkp://keyserver.ubuntu.com --send-key %LONG_ID% && \

## Secrets

Next, you'll need to declare four environment variables in your CI. Open the
settings page for your CI provider.

- **GitHub Actions**:
Next, you'll need to declare four environment variables in your CI.

Select `Settings -> Secrets and variables -> Actions -> New repository secret` to add each of the
required variables as shown in the next figure:
Select `Settings -> Secrets and variables -> Actions -> New repository secret` to add each of the
required variables as shown in the next figure:

![github-secrets-2021-01-27](https://user-images.githubusercontent.com/933058/111891685-e0e12400-89b1-11eb-929c-24f5b48b24de.png)

When complete, your secrets settings should look like the following:
When complete, your secrets settings should look like the following:

![github-env-vars-2021-01-27](https://user-images.githubusercontent.com/933058/111891688-ec344f80-89b1-11eb-9037-9899e5183ad9.png)

- **Travis CI**:
- Make sure that "Build pushed branches" setting is enabled.
- If any secrets contain bash special characters, make sure to
escape them by wrapping it in single quotes `'my?$ecret'`,
see [Travis Environment Variables](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings).

Add the following secrets:

- `PGP_PASSPHRASE`: The randomly generated password you used to create a fresh
@@ -246,14 +234,10 @@ gpg --armor --export-secret-keys %LONG_ID% | openssl base64
*If you try to display the base64 encoded string in the terminal, some shells (like zsh or fish)
may include an additional % character at the end, to mark the end of content which was not terminated by a newline character. This does not indicate a problem.
Note for Windows - delete any linebreaks or spaces when copying the encoded string from terminal.*
- `SONATYPE_PASSWORD`: The password you use to log into
https://s01.oss.sonatype.org/ (or https://oss.sonatype.org/ if your Sonatype
account was created before February 2021). Alternatively, the password part of
the user token if you generated one above.
- `SONATYPE_USERNAME`: The username you use to log into
https://s01.oss.sonatype.org/ (or https://oss.sonatype.org/ if your Sonatype
account was created before 2021). Alternatively, the name part of the user
token if you generated one above.
- `SONATYPE_PASSWORD`: The password part of your Sonatype
[OSSRH token](https://central.sonatype.org/publish/generate-token/), generated on your Nexus server https://s01.oss.sonatype.org/ or https://oss.sonatype.org/ (not the account password!).
- `SONATYPE_USERNAME`: The username part of your Sonatype
user token (not the account username!).
- (optional) `CI_RELEASE`: the command to publish all artifacts for stable
releases. Defaults to `+publishSigned` if not provided.
- (optional) `CI_SNAPSHOT_RELEASE`: the command to publish all artifacts for a
@@ -263,8 +247,6 @@ Note for Windows - delete any linebreaks or spaces when copying the encoded stri
projects to change to `sonatypeReleaseAll`. Defaults to
`sonatypeBundleRelease` if not provided.

### GitHub Actions

Run the following command to install the same
[`release.yml`](https://github.com/sbt/sbt-ci-release/blob/main/.github/workflows/release.yml)
script that is used to release this repository.
@@ -276,61 +258,6 @@ mkdir -p .github/workflows && \

Commit the file and merge into main.

### Travis

> Skip this step if you're using GitHub Actions. > Unless you have a specific
> reason to use Travis, we recommend using GitHub Actions because > it's easier
> to configure.
Next, update `.travis.yml` to trigger `ci-release` on successful merge into
master and on tag push. There are many ways to do this, but I recommend using
[Travis "build stages"](https://docs.travis-ci.com/user/build-stages/). It's not
necessary to use build stages but they make it easy to avoid publishing the same
module multiple times from parallel jobs.

- First, ensure that git tags are always fetched so that sbt-dynver can pick up
the correct `version`

```yml
before_install:
- git fetch --tags
```
- Next, define `test` and `release` build stages

```yml
stages:
- name: test
- name: release
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork
```

- Lastly, define your build matrix with `ci-release` at the bottom, for example:

```yml
jobs:
include:
# stage="test" if no stage is specified
- name: compile
script: sbt compile
- name: formatting
script: ./bin/scalafmt --test
# run ci-release only if previous stages passed
- stage: release
script: sbt ci-release
```

Notes:

- if we use `after_success` instead of build stages, we would run `ci-release`
after both `formatting` and `compile`. As long as you make sure you don't
publish the same module multiple times, you can use any Travis configuration
you like
- the `name: compile` part is optional but it makes it easy to distinguish
different jobs in the Travis UI

![build__48_-_sbt-ci-release_-_travis_ci](https://user-images.githubusercontent.com/1408093/41810442-a44ef526-76fe-11e8-92f4-4c4b61af4d38.jpg)

## Git

We're all set! Time to manually try out the new setup
@@ -347,10 +274,7 @@ Note that the tag version MUST start with `v`.

It is normal that something fails on the first attempt to publish from CI. Even
if it takes 10 attempts to get it right, it's still worth it because it's so
nice to have automatic CI releases. If all is correctly setup, your Travis jobs
page will look like this:

<img width="1058" alt="screen shot 2018-06-23 at 15 48 43" src="https://user-images.githubusercontent.com/1408093/41810386-b8c11198-76fd-11e8-8be1-54b84181e60d.png">
nice to have automatic CI releases.

Enjoy 👌

@@ -410,16 +334,12 @@ If you prefer to keep most of the information in a git branch instead, you can j

As of February 2024, Sonatype has released a new portal, called Sonatype Central. Users can configure their libraries to be published via this portal by adding the following to `build.sbt`:

```sbt
```sbt
import xerial.sbt.Sonatype.sonatypeCentralHost

ThisBuild / sonatypeCredentialHost := sonatypeCentralHost
```

Users can generate a two-part token, containing username and password values, in their [account](https://central.sonatype.com/account) and then set these to the _SONATYPE_USERNAME_ and _SONATYPE_PASSWORD_ environment variables. All other steps should then work as documented.



### How do I disable publishing in certain projects?

Add the following to the project settings (works only in sbt 1)
@@ -464,8 +384,6 @@ Next, add an additional `ci-release` step in your CI config to publish the
custom Scala.js version

```diff
// .travis.yml
sbt ci-release
+ SCALAJS_VERSION=0.6.31 sbt ci-release
```

@@ -520,13 +438,14 @@ coursier fetch com.github.sbt:scalafmt-cli_2.12:1.5.0-SNAPSHOT -r sonatype:snaps

Use `-r https://s01.oss.sonatype.org/content/repositories/snapshots` instead if your Sonatype account was created after February 2021.

### What about other CIs environments than Travis?
### What about other CI environments?

- This project uses a github workflow,
[which you can review here](https://github.com/sbt/sbt-ci-release/tree/master/.github/workflows)
- [CircleCI](https://circleci.com/) is supported
If you are still using Travis-CI, see old revisions of this readme
for instructions.

You can try
[CircleCI](https://circleci.com/) should work as well.

You could also try
[sbt-release-early](https://github.com/scalacenter/sbt-release-early).

Alternatively, the source code for sbt-ci-release is only ~50 loc, see
@@ -560,12 +479,6 @@ repository. If you pushed a tag, make sure the tag version number starts with
`v`. This error can happen if you tag with the version `0.1.0` instead of
`v0.1.0`.

### java.io.IOException: Access to URL was refused by the server: Unauthorized

Make sure that `SONATYPE_PASSWORD` uses proper escaping if it contains special
characters as documented on
[Travis Environment Variables](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings).

### Failed: signature-staging, failureMessage:Missing Signature:

Make sure to upgrade to the latest sbt-ci-release, which could fix this error.
@@ -596,10 +509,8 @@ project?
[Add it in a PR!](https://github.com/sbt/sbt-ci-release/edit/main/readme.md)

- [AlexITC/scala-js-chrome](https://github.com/AlexITC/scala-js-chrome)
- [almond-sh/almond](https://github.com/almond-sh/almond/)
- [an-tex/sc8s](https://github.com/an-tex/sc8s)
- [bitcoin-s/bitcoin-s](https://github.com/bitcoin-s/bitcoin-s)
- [coursier/coursier](https://github.com/coursier/coursier/)
- [ekrich/sconfig](https://github.com/ekrich/sconfig/)
- [fd4s/fs2-kafka](https://github.com/fd4s/fs2-kafka)
- [fd4s/vulcan](https://github.com/fd4s/vulcan)
@@ -638,8 +549,7 @@ setup.
- [sbt-ci-release-early](https://github.com/ShiftLeftSecurity/sbt-ci-release-early):
very similar to sbt-ci-release except doesn't use SNAPSHOT versions.
- [sbt-release-early](https://github.com/scalacenter/sbt-release-early):
additionally supports publishing to Bintray and other CI environments than
Travis.
additionally supports other publishing providers and other CI environments.
- [sbt-rig](https://github.com/Verizon/sbt-rig): additionally supporting
publishing code coverage reports, managing test dependencies and publishing
docs.