diff --git a/.github/workflows/unsloth-sd-prebuilt.yml b/.github/workflows/unsloth-sd-prebuilt.yml index 3b1222e2c..e65b9b80d 100644 --- a/.github/workflows/unsloth-sd-prebuilt.yml +++ b/.github/workflows/unsloth-sd-prebuilt.yml @@ -60,6 +60,11 @@ on: default: false required: false type: boolean + keep_artifacts: + description: 'Keep this run''s artifacts even if it publishes nothing (artifact-only test runs)' + default: false + required: false + type: boolean permissions: contents: read @@ -647,12 +652,26 @@ jobs: done [ "$fail" = 0 ] || { echo "ERROR: refusing to publish a partial release" >&2; exit 1; } + # Only on a run that did NOT succeed, matching llama.cpp. Uploading this + # unconditionally duplicated every bundle in the run -- measured at 1.34 GiB + # per run, byte-for-byte the same content as the six -bin- artifacts beside + # it. On a green publish those bytes are already release assets, and + # reclaim below cannot delete this copy because an aggregate matches no + # single asset name, so it was the largest survivor of every cleanup. + # + # !success() rather than failure(): a cancelled run is exactly when a + # human wants the rescue bundle. - name: Upload full set (artifact fallback) + if: ${{ always() && !success() }} uses: actions/upload-artifact@v4 with: name: unsloth-sd-prebuilt-${{ needs.resolve.outputs.tag }} path: dist/* - if-no-files-found: error + # warn, not error: an early failure can leave dist/ absent, and a + # missing debug bundle must not turn a diagnosable failure into a + # confusing second one. + if-no-files-found: warn + overwrite: true retention-days: 7 - name: Publish GitHub release @@ -782,7 +801,7 @@ jobs: # run's release. So the rule is simply that nothing will ever consume # these -- a publish:false dispatch is a test, and a cancelled or failed # run is not resumable past the missing legs -- and they are deleted. - if: ${{ needs.assemble.outputs.published != 'true' }} + if: ${{ needs.assemble.outputs.published != 'true' && inputs.keep_artifacts != true }} continue-on-error: true env: GH_TOKEN: ${{ github.token }}