Skip to content

Commit 91b4ae1

Browse files
Always build and publish CUDA artifacts; remove manual workflow inputs (#165)
* ci: sign snapshot artifacts and mirror release pipeline order Snapshots were deployed to Maven Central unsigned (deploy:deploy-file without GPG) and the GitHub snapshot pre-release attached unsigned jars. Wire GPG into the snapshot path and reorder so publish-snapshot signs + deploys first, then github-snapshot attaches the signed assets. Same shape as publish-release -> github-release-signed. The CUDA classifier jar is intentionally excluded from snapshots (CUDA crosscompile is opt-in and slow). To make that possible without the cuda jar execution running on every package, split it out of the release profile into its own cuda profile in pom.xml. The package job and publish-release now activate both profiles (-P release,cuda); publish-snapshot activates only -P release. * ci: simplify CUDA + release flags out of the publish pipeline CUDA cross-compile now always runs and the CUDA classifier is always included in package, publish-snapshot, and publish-release. Drops the dead enable_cuda_build flag (it built CUDA but the snapshot deploy ignored it) and the release_to_maven_central gate (tag pushes never auto-published anyway since the input is only set via workflow_dispatch). Tag push now auto-publishes to Maven Central, signed, with CUDA. https://claude.ai/code/session_01SxxLmcu9vgaPjKnSPeTjEx --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent f8c6afc commit 91b4ae1

2 files changed

Lines changed: 61 additions & 63 deletions

File tree

.github/workflows/publish.yml

Lines changed: 54 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ on:
1010
tags: ['v*']
1111
pull_request:
1212
workflow_dispatch:
13-
inputs:
14-
release_to_maven_central:
15-
description: 'Release to Maven Central (true/false)'
16-
required: false
17-
default: 'false'
18-
enable_cuda_build:
19-
description: 'Compile CUDA artifacts (slow — nvcc install + build). Auto-enabled on tag pushes.'
20-
required: false
21-
default: 'false'
2213
env:
2314
JAVA_VERSION: '21'
2415
MODEL_URL: "https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/resolve/main/codellama-7b.Q2_K.gguf"
@@ -54,8 +45,6 @@ jobs:
5445
name: Cross-Compile manylinux_2_28 x86_64 (CUDA)
5546
needs: startgate
5647
runs-on: ubuntu-latest
57-
outputs:
58-
built: ${{ steps.build.outputs.built }}
5948
steps:
6049
- uses: actions/checkout@v6
6150
- name: Display CPU Info
@@ -67,18 +56,10 @@ jobs:
6756
echo "=== CPU Details from /proc/cpuinfo ==="
6857
cat /proc/cpuinfo
6958
- name: Build libraries
70-
id: build
7159
shell: bash
7260
run: |
73-
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" || "${{ github.event.inputs.enable_cuda_build }}" == "true" ]]; then
74-
.github/dockcross/dockcross-manylinux_2_28-x64 .github/build_cuda_linux.sh "-DOS_NAME=Linux -DOS_ARCH=x86_64"
75-
echo "built=true" >> "$GITHUB_OUTPUT"
76-
else
77-
echo "CUDA compilation skipped — set enable_cuda_build=true or trigger a release event to build CUDA artifacts"
78-
echo "built=false" >> "$GITHUB_OUTPUT"
79-
fi
61+
.github/dockcross/dockcross-manylinux_2_28-x64 .github/build_cuda_linux.sh "-DOS_NAME=Linux -DOS_ARCH=x86_64"
8062
- name: Upload artifacts
81-
if: steps.build.outputs.built == 'true'
8263
uses: actions/upload-artifact@v7
8364
with:
8465
name: linux-libraries-cuda
@@ -616,8 +597,7 @@ jobs:
616597
pattern: "*-libraries"
617598
merge-multiple: true
618599
path: ${{ github.workspace }}/src/main/resources/net/ladenthin/llama/
619-
- if: needs.crosscompile-linux-x86_64-cuda.outputs.built == 'true'
620-
uses: actions/download-artifact@v8
600+
- uses: actions/download-artifact@v8
621601
with:
622602
name: linux-libraries-cuda
623603
path: ${{ github.workspace }}/src/main/resources_linux_cuda/net/ladenthin/llama/
@@ -626,7 +606,7 @@ jobs:
626606
distribution: 'temurin'
627607
java-version: ${{ env.JAVA_VERSION }}
628608
- name: Build JARs
629-
run: mvn --batch-mode --no-transfer-progress -P release -Dmaven.test.skip=true -Dgpg.skip=true package
609+
run: mvn --batch-mode --no-transfer-progress -P release,cuda -Dmaven.test.skip=true -Dgpg.skip=true package
630610
- name: Upload JARs
631611
uses: actions/upload-artifact@v7
632612
with:
@@ -681,17 +661,62 @@ jobs:
681661
- name: Confirm tag ref
682662
run: echo "Confirmed on tag ${{ github.ref }}"
683663

664+
publish-snapshot:
665+
name: Publish Snapshot to Central
666+
needs: [check-snapshot, crosscompile-linux-x86_64-cuda]
667+
if: needs.check-snapshot.result == 'success'
668+
runs-on: ubuntu-latest
669+
environment: maven-central
670+
permissions:
671+
contents: write
672+
steps:
673+
- uses: actions/checkout@v6
674+
- uses: actions/download-artifact@v8
675+
with:
676+
pattern: "*-libraries"
677+
merge-multiple: true
678+
path: ${{ github.workspace }}/src/main/resources/net/ladenthin/llama/
679+
- uses: actions/download-artifact@v8
680+
with:
681+
name: linux-libraries-cuda
682+
path: ${{ github.workspace }}/src/main/resources_linux_cuda/net/ladenthin/llama/
683+
- name: Set up Maven Central Repository
684+
uses: actions/setup-java@v5
685+
with:
686+
java-version: ${{ env.JAVA_VERSION }}
687+
distribution: 'temurin'
688+
server-id: central
689+
server-username: MAVEN_USERNAME
690+
server-password: MAVEN_PASSWORD
691+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
692+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
693+
- name: Publish snapshot
694+
run: mvn --batch-mode -P release,cuda -Dmaven.test.skip=true deploy
695+
env:
696+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
697+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
698+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
699+
- name: Collect signed artifacts
700+
run: |
701+
mkdir -p signed-snapshot-assets
702+
cp target/*.jar signed-snapshot-assets/ 2>/dev/null || true
703+
cp target/*.jar.asc signed-snapshot-assets/ 2>/dev/null || true
704+
- uses: actions/upload-artifact@v7
705+
with:
706+
name: signed-snapshot-assets
707+
path: signed-snapshot-assets/
708+
684709
github-snapshot:
685710
name: Update Snapshot Pre-release on GitHub
686-
needs: [check-snapshot]
687-
if: needs.check-snapshot.result == 'success'
711+
needs: [publish-snapshot]
712+
if: needs.publish-snapshot.result == 'success'
688713
runs-on: ubuntu-latest
689714
permissions:
690715
contents: write
691716
steps:
692717
- uses: actions/download-artifact@v8
693718
with:
694-
name: llama-jars
719+
name: signed-snapshot-assets
695720
path: snapshot-assets/
696721
- name: Update snapshot pre-release
697722
env:
@@ -707,42 +732,9 @@ jobs:
707732
--repo ${{ github.repository }} \
708733
--clobber
709734
710-
publish-snapshot:
711-
name: Publish Snapshot to Central
712-
needs: [github-snapshot, check-snapshot]
713-
if: needs.check-snapshot.result == 'success'
714-
runs-on: ubuntu-latest
715-
environment: maven-central
716-
steps:
717-
- uses: actions/checkout@v6
718-
- uses: actions/download-artifact@v8
719-
with:
720-
name: llama-jars
721-
path: snapshot-jars/
722-
- uses: actions/setup-java@v5
723-
with:
724-
java-version: ${{ env.JAVA_VERSION }}
725-
distribution: temurin
726-
server-id: central
727-
server-username: MAVEN_USERNAME
728-
server-password: MAVEN_PASSWORD
729-
- name: Deploy snapshot
730-
run: |
731-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
732-
mvn --batch-mode deploy:deploy-file \
733-
-Durl=https://central.sonatype.com/repository/maven-snapshots \
734-
-DrepositoryId=central \
735-
-Dfile=snapshot-jars/llama-${VERSION}.jar \
736-
-DpomFile=pom.xml \
737-
-Dsources=snapshot-jars/llama-${VERSION}-sources.jar \
738-
-Djavadoc=snapshot-jars/llama-${VERSION}-javadoc.jar
739-
env:
740-
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
741-
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
742-
743735
publish-release:
744736
name: Publish Release to Central
745-
if: needs.check-tag.result == 'success' && github.event.inputs.release_to_maven_central == 'true'
737+
if: needs.check-tag.result == 'success'
746738
needs: [check-tag, crosscompile-linux-x86_64-cuda]
747739
runs-on: ubuntu-latest
748740
environment: maven-central
@@ -755,8 +747,7 @@ jobs:
755747
pattern: "*-libraries"
756748
merge-multiple: true
757749
path: ${{ github.workspace }}/src/main/resources/net/ladenthin/llama/
758-
- if: needs.crosscompile-linux-x86_64-cuda.outputs.built == 'true'
759-
uses: actions/download-artifact@v8
750+
- uses: actions/download-artifact@v8
760751
with:
761752
name: linux-libraries-cuda
762753
path: ${{ github.workspace }}/src/main/resources_linux_cuda/net/ladenthin/llama/
@@ -771,7 +762,7 @@ jobs:
771762
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
772763
gpg-passphrase: MAVEN_GPG_PASSPHRASE
773764
- name: Publish release
774-
run: mvn --batch-mode -P release -Dmaven.test.skip=true deploy
765+
run: mvn --batch-mode -P release,cuda -Dmaven.test.skip=true deploy
775766
env:
776767
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
777768
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,14 @@ SPDX-License-Identifier: MIT
240240
<waitUntil>published</waitUntil>
241241
</configuration>
242242
</plugin>
243+
</plugins>
244+
</build>
245+
</profile>
243246

247+
<profile>
248+
<id>cuda</id>
249+
<build>
250+
<plugins>
244251
<plugin>
245252
<groupId>org.apache.maven.plugins</groupId>
246253
<artifactId>maven-jar-plugin</artifactId>

0 commit comments

Comments
 (0)