Skip to content

Commit

Permalink
try to fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Sep 23, 2024
1 parent b00bae1 commit 280e414
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 52 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ on:

jobs:
publish-maven:
strategy:
matrix:
shard: [ 1, 2, 3, 4, 5, 6]
fail-fast: false

runs-on: ubuntu-latest
env:
SONATYPE_DEPLOY_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_DEPLOY_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
SONATYPE_PGP_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
SONATYPE_PGP_PRIVATE_KEY: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
Expand All @@ -29,8 +26,18 @@ jobs:
with:
java-version: '8'
distribution: temurin
- run: test -z "$SONATYPE_PGP_SECRET" || echo "$SONATYPE_PGP_SECRET" | base64 --decode | gpg --import --no-tty --batch --yes
- run: GPG_TTY=$(tty) ./mill -i publishSonatype __.publishArtifacts --shard ${{ matrix.shard }} --divisionCount 6
- run: |
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key
gpg --import --no-tty --batch --yes gpg_key
rm gpg_key
./mill -i mill.scalalib.PublishModule/publishAll \
--sonatypeCreds $SONATYPE_USER:$SONATYPE_PASSWORD \
--gpgArgs --passphrase=$SONATYPE_PGP_PRIVATE_KEY_PASSWORD,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \
--publishArtifacts __.publishArtifacts \
--readTimeout 600000 \
--awaitTimeout 600000 \
--release true \
--signed true
publish-docs:
runs-on: ubuntu-latest
Expand Down
42 changes: 0 additions & 42 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1007,48 +1007,6 @@ def partition(

}

def publishSonatype(
publishArtifacts: mill.main.Tasks[PublishModule.PublishData],
shard: Int,
divisionCount: Int
) =
T.command {

val x: Seq[(Seq[(os.Path, String)], Artifact)] = {
mill.define.Target.sequence(partition(publishArtifacts, shard, divisionCount))().map {
case PublishModule.PublishData(a, s) => (s.map { case (p, f) => (p.path, f) }, a)
}
}
if (isPublishableCommit)
new SonatypePublisher(
uri = "https://oss.sonatype.org/service/local",
snapshotUri = "https://oss.sonatype.org/content/repositories/snapshots",
credentials = sys.env("SONATYPE_DEPLOY_USER") + ":" + sys.env("SONATYPE_DEPLOY_PASSWORD"),
signed = true,
gpgArgs = Seq(
"--passphrase",
sys.env("SONATYPE_PGP_PASSWORD"),
"--no-tty",
"--pinentry-mode",
"loopback",
"--batch",
"--yes",
"-a",
"-b"
),
readTimeout = 600000,
connectTimeout = 600000,
log = T.ctx().log,
workspace = T.workspace,
env = T.env,
awaitTimeout = 600000,
stagingRelease = true
).publishAll(
true,
x: _*
)
}

/**
* Somethime, the Mill publish command fails although the Sonatype publishing went through.
* This command checks, whether all artifacts are publshed.
Expand Down

0 comments on commit 280e414

Please sign in to comment.