From d05ee17d26c09ceefb21f1dd47ccb915a91157a7 Mon Sep 17 00:00:00 2001 From: Greg von Nessi Date: Sat, 14 Mar 2026 20:36:44 +0000 Subject: [PATCH] Restrict CI publish to tag pushes only SNAPSHOT publishing on main pushes fails with 403, causing the CI badge to show as failing even though all tests pass. Limit the publish job to tag pushes where credentials are configured correctly. --- .github/workflows/ci.yml | 8 ++++---- build.sbt | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79ecbf0..0880ebe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,15 +73,15 @@ jobs: run: sbt '++ ${{ matrix.scala }}' doc - name: Make target directories - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) run: mkdir -p target project/target - name: Compress target directories - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) run: tar cf targets.tar target project/target - name: Upload target directories - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) uses: actions/upload-artifact@v5 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }} @@ -90,7 +90,7 @@ jobs: publish: name: Publish Artifacts needs: [build] - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) strategy: matrix: os: [blacksmith-2vcpu-ubuntu-2204] diff --git a/build.sbt b/build.sbt index 276dbb6..339a8ce 100644 --- a/build.sbt +++ b/build.sbt @@ -12,6 +12,9 @@ ThisBuild / developers ++= List( ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("21")) ThisBuild / githubWorkflowOSes := Seq("blacksmith-2vcpu-ubuntu-2204") +// Only publish on tag pushes (not main) to avoid SNAPSHOT publish failures +ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))) + scalaVersion := DependencyVersions.scala2p13Version ThisBuild / crossScalaVersions := Seq(DependencyVersions.scala2p13Version, DependencyVersions.scala3Version) ThisBuild / tlVersionIntroduced := Map("2.13" -> "0.16", "3" -> "0.16")