From f905ab909a6f96e78ee7cd2a7713fe7422d06e52 Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Mon, 20 Apr 2026 13:30:06 -0700 Subject: [PATCH] ci: add workflow_dispatch trigger to publish workflow --- .github/workflows/publish.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4d91d0fe9..a58698bbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,12 @@ on: pull_request: types: [closed] branches: [main] + workflow_dispatch: + inputs: + version: + description: "Version to publish (e.g. 0.4.11). Tag v must already exist." + required: true + type: string jobs: publish: @@ -17,19 +23,30 @@ jobs: permissions: contents: write id-token: write - # Run on tag push OR when a release/* PR is merged + # Run on tag push, manual dispatch, OR when a release/* PR is merged if: >- github.event_name == 'push' || + github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')) steps: - uses: actions/checkout@v4 + with: + # On manual dispatch, check out the existing tag so we publish the + # exact commit that was tagged — not whatever is currently on main. + ref: >- + ${{ github.event_name == 'workflow_dispatch' + && format('refs/tags/v{0}', inputs.version) + || github.ref }} - name: Resolve version id: version run: | if [ "${{ github.event_name }}" = "push" ]; then VERSION="${GITHUB_REF_NAME#v}" + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ inputs.version }}" + VERSION="${VERSION#v}" else BRANCH="${{ github.event.pull_request.head.ref }}" VERSION="${BRANCH#release/v}"