Skip to content

Commit b502a1c

Browse files
Merge pull request #241 from bernardladenthin/claude/stoic-franklin-67klln
Add manual publish control to CI workflow
2 parents 91d9799 + 02c02d0 commit b502a1c

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
tags: ['v*']
1111
pull_request:
1212
workflow_dispatch:
13+
inputs:
14+
publish_to_central:
15+
description: "Deploy to Maven Central (snapshot if -SNAPSHOT, release if a vX.Y.Z tag)"
16+
type: boolean
17+
default: false
1318
env:
1419
JAVA_VERSION: '21'
1520
MODEL_URL: "https://huggingface.co/TheBloke/CodeLlama-7B-GGUF/resolve/main/codellama-7b.Q2_K.gguf"
@@ -871,7 +876,7 @@ jobs:
871876
publish-snapshot:
872877
name: Publish Snapshot to Central
873878
needs: [check-snapshot, crosscompile-linux-x86_64-cuda, crosscompile-android-aarch64-opencl, code-style]
874-
if: needs.check-snapshot.result == 'success'
879+
if: needs.check-snapshot.result == 'success' && inputs.publish_to_central
875880
runs-on: ubuntu-latest
876881
environment: maven-central
877882
permissions:
@@ -901,6 +906,15 @@ jobs:
901906
server-password: MAVEN_PASSWORD
902907
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
903908
gpg-passphrase: MAVEN_GPG_PASSPHRASE
909+
- name: Guard - require a -SNAPSHOT version
910+
shell: bash
911+
run: |
912+
VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version | tail -n1)
913+
echo "Resolved project version: $VERSION"
914+
case "$VERSION" in
915+
*-SNAPSHOT) echo "OK: -SNAPSHOT version, continuing snapshot deploy." ;;
916+
*) echo "::error::Refusing to publish non-SNAPSHOT version '$VERSION' from the snapshot job. Snapshot publishing requires a -SNAPSHOT version; releases go through the v* tag path."; exit 1 ;;
917+
esac
904918
- name: Publish snapshot
905919
run: mvn --batch-mode --no-transfer-progress -P release,cuda,opencl-android -Dmaven.test.skip=true deploy
906920
env:
@@ -945,7 +959,7 @@ jobs:
945959
946960
publish-release:
947961
name: Publish Release to Central
948-
if: needs.check-tag.result == 'success'
962+
if: needs.check-tag.result == 'success' && inputs.publish_to_central
949963
needs: [check-tag, crosscompile-linux-x86_64-cuda, crosscompile-android-aarch64-opencl, code-style]
950964
runs-on: ubuntu-latest
951965
environment: maven-central

0 commit comments

Comments
 (0)