-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly switch to Sonatype token authentication #23
Explicitly switch to Sonatype token authentication #23
Conversation
69174f1
to
8bd424a
Compare
a9d0967
to
8663357
Compare
8663357
to
10a173c
Compare
2aa00e8
to
3cf313f
Compare
Token auth is now mandatory: xerial/sbt-sonatype#464 (comment) In January 2024, Sonatype started actively discouraging the legacy username & password method of authentication, recommending token authentication instead: * https://central.sonatype.org/news/20240109_issues_sonatype_org_deprecation/#support-requests * https://central.sonatype.org/publish/generate-token/ In this new scheme, the token is still split into a username/password format, and both are randomised strings, making the username portion a meaningful secret (ie one that can be revoked) and so worthy of being treated as a secret.
3cf313f
to
23a148a
Compare
export SONATYPE_USERNAME="${SONATYPE_TOKEN%%:*}" # See https://github.com/xerial/sbt-sonatype/pull/62 | ||
export SONATYPE_PASSWORD="${SONATYPE_TOKEN#*:}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines (using BASH Shell Parameter Expansion to chop the user:pass
token string into user
& pass
) will no longer be necessary if xerial/sbt-sonatype#464 is merged & released.
Note that export
is crucial here - without it, sbt "sonatypeBundleRelease"
doesn't receive the SONATYPE_USERNAME
& SONATYPE_PASSWORD
. This is because exported variables get passed on to child processes, not-exported variables do not - and sbt
runs as a child process.
* `AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD` | ||
* `AUTOMATED_MAVEN_RELEASE_SONATYPE_TOKEN` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is covered by https://github.com/guardian/github-secret-access/pull/55.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thank you Roberto!
In particular, updating config for: * guardian/gha-scala-library-release-workflow#23 - Sonatype token authentication
In particular, updating config for: * guardian/gha-scala-library-release-workflow#23 - Sonatype token authentication
In particular, updating config for: * guardian/gha-scala-library-release-workflow#23 - Sonatype token authentication
This PR fixes #39, updating
gha-scala-library-release-workflow
to take a single colon-separated composite API token (username:password
) for auth, rather than the old Nexus UI username & password combination, which is now rejected by Sonatype.Changes required to repos using
gha-scala-library-release-workflow
All repos need to update their
.github/workflows/release.yml
to use the workflow's newSONATYPE_TOKEN
parameter (the oldSONATYPE_PASSWORD
parameter has been dropped):Before
After
Updating many projects at once
As in #36, it was possible to update many of the ~30 projects using
gha-scala-library-release-workflow
using a switch-release-yml-to-token-auth.sh script that I hammered together:Testing
An example of a successful release with this change (at commit 23a148a) is:
https://github.com/guardian/etag-caching/actions/runs/9588801840
See also
SONATYPE_TOKEN
environment variable for token authentication xerial/sbt-sonatype#464