diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df4e2caa..de71fe73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: publish: name: Publish Artifacts needs: [build] - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/heads/master')) + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) strategy: matrix: os: [ubuntu-latest] diff --git a/build.sbt b/build.sbt index 15302884..b8702ef3 100644 --- a/build.sbt +++ b/build.sbt @@ -183,9 +183,12 @@ ThisBuild / githubWorkflowBuild := Seq( ) //sbt-ci-release settings ThisBuild / githubWorkflowTargetTags ++= Seq("v*") -ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Branch("master"))) -ThisBuild / githubWorkflowPublishPreamble := Seq(WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3"))) -ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release"))) +ThisBuild / githubWorkflowPublishTargetBranches := Seq( + RefPredicate.Equals(Ref.Branch("master")), + RefPredicate.StartsWith(Ref.Tag("v")) +) +ThisBuild / githubWorkflowPublishPreamble := Seq(WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3"))) +ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release"))) ThisBuild / githubWorkflowEnv ++= List("PGP_PASSPHRASE", "PGP_SECRET", "SONATYPE_PASSWORD", "SONATYPE_USERNAME").map { envKey => envKey -> s"$${{ secrets.$envKey }}"