diff --git a/.github/workflows/winget-publish.yml b/.github/workflows/winget-publish.yml index 6404fa36..d113461e 100644 --- a/.github/workflows/winget-publish.yml +++ b/.github/workflows/winget-publish.yml @@ -3,6 +3,12 @@ name: Publish to WinGet on: release: types: [published] + workflow_dispatch: + inputs: + release-tag: + description: 'Release tag to publish (e.g. 0.14.2)' + required: true + type: string permissions: contents: read @@ -10,11 +16,14 @@ permissions: jobs: publish: name: Publish to WinGet - # Only publish versioned releases — skip the rolling 'latest' tag on main - if: github.event.release.tag_name != 'latest' + # For releases: skip the rolling 'latest' tag on main. + # For manual dispatch: always run (the operator knows what they're doing). + if: >- + github.event_name != 'release' || + github.event.release.tag_name != 'latest' runs-on: ubuntu-latest concurrency: - group: winget-publish-${{ github.event.release.tag_name }} + group: winget-publish-${{ github.event.release.tag_name || inputs.release-tag }} cancel-in-progress: true environment: @@ -41,16 +50,20 @@ jobs: # Setup — create a fine-grained PAT: # 1. GitHub → Settings → Developer settings → Personal access tokens # → Fine-grained tokens → Generate new token - # 2. Resource owner: DFetch-org (or your user) + # 2. Resource owner: DFetch-org # 3. Repository access: All repositories - # (needed to fork microsoft/winget-pkgs and push the manifest branch) + # (needed to push the manifest branch to dfetch-org/winget-pkgs) # 4. Permissions: # Contents → Read and write # Pull requests → Read and write # 5. Store the token as secret WINGET_TOKEN in: # Repo → Settings → Environments → winget → Environment secrets + # + # Prerequisites: dfetch-org/winget-pkgs must exist as a fork of + # microsoft/winget-pkgs (create it once manually on GitHub). uses: vedantmgoyal9/winget-releaser@4ffc7888bffd451b357355dc214d43bb9f23917e # v2 with: identifier: DFetch-org.DFetch - release-tag: ${{ github.event.release.tag_name }} + release-tag: ${{ github.event.release.tag_name || inputs.release-tag }} token: ${{ secrets.WINGET_TOKEN }} + fork-user: dfetch-org