From 6eb675277be8ab8b632bbe5e224237cf8d238246 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 4 Nov 2026 14:12:20 -0800 Subject: [PATCH] Add opt-in signing to native workflow Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/regenerate-native.yml | 17 ++++++++++------- README.md | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/regenerate-native.yml b/.github/workflows/regenerate-native.yml index 12684523..52c62637 100644 --- a/.github/workflows/regenerate-native.yml +++ b/.github/workflows/regenerate-native.yml @@ -9,8 +9,8 @@ name: regenerate-native # regenerates for that same reason or whenever sources/libClangSharp changes. Both can also be # forced via workflow_dispatch. See the "Regenerating native binaries" section in README.md. # -# The jobs upload the resulting .nupkg files as build artifacts and sign them via the -# separate sign-nuget leg; publishing to NuGet is manual. +# The jobs upload the resulting .nupkg files as build artifacts. Push runs sign them +# automatically; workflow_dispatch can opt in to signing. Publishing to NuGet is manual. on: push: @@ -25,6 +25,10 @@ on: description: "Force regenerating the libClangSharp runtime packages" type: boolean default: false + sign: + description: "Sign the generated native packages" + type: boolean + default: false permissions: contents: read @@ -168,12 +172,11 @@ jobs: sign-nuget: needs: [ libclang, libclangsharp-pack ] - # Sign on pushes to main whenever the legs that actually ran succeeded. A leg that - # was version-gated out is 'skipped' (not a failure), so a libClangSharp-only - # regeneration still gets signed; a real failure or cancellation blocks signing. + # Sign pushes automatically and allow workflow_dispatch to opt in. A leg that was + # version-gated out is 'skipped' (not a failure); failures block signing. if: >- - ${{ github.event_name == 'push' - && !cancelled() + ${{ !cancelled() + && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.sign)) && needs.libclang.result != 'failure' && needs.libclangsharp-pack.result != 'failure' && (needs.libclang.result == 'success' || needs.libclangsharp-pack.result == 'success') }} diff --git a/README.md b/README.md index 1ec7fc86..18457461 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ The jobs run when: * **libclang** — the tracked LLVM major/minor version changes, or the workflow is dispatched manually with the `libclang` input set. * **libClangSharp** — the same LLVM version change, or anything under `sources/libClangSharp/` changes, or the workflow is dispatched manually with the `libclangsharp` input set. -Before anything is downloaded, the workflow verifies the `packages/**/*.nuspec` and `packages/**/runtime.json` versions match the tracked LLVM version (libclang exactly; libClangSharp as `.`), so a version bump that forgot to update a package fails fast. Each job uploads the resulting `.nupkg` files as build artifacts and signs them; publishing them to NuGet.org is a manual step. To move to a new LLVM release, bump the version in `CMakeLists.txt` alongside the `` in the affected `packages/**/*.nuspec` files (and the versions in `packages/**/runtime.json` and this README); pushing that change regenerates the packages. +Before anything is downloaded, the workflow verifies the `packages/**/*.nuspec` and `packages/**/runtime.json` versions match the tracked LLVM version (libclang exactly; libClangSharp as `.`), so a version bump that forgot to update a package fails fast. Each job uploads the resulting `.nupkg` files as build artifacts. Push-triggered runs sign them automatically; manually dispatched runs can opt in to signing. Publishing them to NuGet.org is a manual step. To move to a new LLVM release, bump the version in `CMakeLists.txt` alongside the `` in the affected `packages/**/*.nuspec` files (and the versions in `packages/**/runtime.json` and this README); pushing that change regenerates the packages. ### Generating Bindings