Skip to content
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

Keep publish secrets scoped to specific steps #92

Merged
merged 6 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
Expand Down Expand Up @@ -96,6 +92,11 @@ jobs:
scala: [2.12.15]
java: [temurin@8]
runs-on: ${{ matrix.os }}
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin {
override def trigger = allRequirements

override def buildSettings = Seq(
githubWorkflowEnv ++= Map(
githubWorkflowPublishEnv ++= Map(
"PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}",
"PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ trait GenerativeKeys {

lazy val githubWorkflowEnv = settingKey[Map[String, String]](
s"A map of static environment variable assignments global to the workflow (default: { GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }} })")
lazy val githubWorkflowPublishEnv = settingKey[Map[String, String]](
s"A map of additional static environment variable assignments scoped to the publish job (default empty)")
lazy val githubWorkflowAddedJobs = settingKey[Seq[WorkflowJob]](
"A list of additional jobs to add to the CI workflow (default: [])")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
githubWorkflowTargetTags := Seq(),
githubWorkflowTargetPaths := Paths.None,
githubWorkflowEnv := Map("GITHUB_TOKEN" -> s"$${{ secrets.GITHUB_TOKEN }}"),
githubWorkflowPublishEnv := Map.empty,
githubWorkflowAddedJobs := Seq()
)

Expand Down Expand Up @@ -675,6 +676,7 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
githubWorkflowPublish.value.toList :::
githubWorkflowPublishPostamble.value.toList,
cond = Some(publicationCond.value),
env = githubWorkflowPublishEnv.value,
scalas = List(scalaVersion.value),
javas = List(githubWorkflowJavaVersions.value.head),
needs = List("build")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object TypelevelSonatypeCiReleasePlugin extends AutoPlugin {
Seq(tlCiReleaseTags := true, tlCiReleaseBranches := Seq())

override def buildSettings = Seq(
githubWorkflowEnv ++= Map(
githubWorkflowPublishEnv ++= Map(
"SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}",
"SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}"
),
Expand Down