Skip to content

Fix: Make winget, AUR, and Chocolatey publishing optional (fixes #155)#156

Merged
wkoszek merged 2 commits intomainfrom
issue/155
Nov 25, 2025
Merged

Fix: Make winget, AUR, and Chocolatey publishing optional (fixes #155)#156
wkoszek merged 2 commits intomainfrom
issue/155

Conversation

@wkoszek
Copy link
Copy Markdown
Contributor

@wkoszek wkoszek commented Nov 25, 2025

Summary

Add skip conditions to winget, AUR, and Chocolatey publishers to skip gracefully when required secrets are not configured, allowing releases to succeed.

Problem

Release was failing because required secrets for optional publishers were not set:

2 errors occurred:
  * winget: map has no entry for key "WINGET_GITHUB_TOKEN"
  * arch user repositories: map has no entry for key "AUR_SSH_KEY"

Also applies to CHOCOLATEY_API_KEY.

Root Cause

We added these publishers in previous PRs but didn't configure the secrets yet:

  • WINGET_GITHUB_TOKEN - GitHub PAT for winget-pkgs PRs
  • AUR_SSH_KEY - SSH key for AUR publishing
  • CHOCOLATEY_API_KEY - API key for Chocolatey

GoReleaser failed when trying to template these env vars.

Solution

Add skip conditions that check if environment variables exist:

winget:
  skip_upload: '{{ not (env "WINGET_GITHUB_TOKEN") }}'

aurs:
  skip_upload: '{{ not (env "AUR_SSH_KEY") }}'

chocolateys:
  skip_publish: '{{ not (env "CHOCOLATEY_API_KEY") }}'

Changes

  • Add skip_upload to aurs configuration
  • Change winget skip_upload from auto to env check
  • Change chocolatey skip_publish from false to env check

Result

  • ✅ Releases succeed without optional publisher secrets
  • ✅ Publishers automatically activate when secrets are configured
  • ✅ No manual config changes needed when adding secrets
  • ✅ Configuration is in place and ready for when secrets are added

Future

When ready to enable these publishers:

  1. Add the required secret to GitHub repository settings
  2. Next release will automatically publish to that platform
  3. No code changes needed

Fixes #155

Add skip conditions to winget, AUR, and Chocolatey publishers to skip
gracefully when required secrets are not configured.

Problem:
Release was failing because required secrets were not set:
- WINGET_GITHUB_TOKEN (for winget publishing)
- AUR_SSH_KEY (for Arch User Repository)
- CHOCOLATEY_API_KEY (for Chocolatey)

Error:
  "map has no entry for key WINGET_GITHUB_TOKEN"
  "map has no entry for key AUR_SSH_KEY"

Solution:
Add skip_upload/skip_publish conditions that check if env vars exist:
- winget: skip_upload: '{{ not (env "WINGET_GITHUB_TOKEN") }}'
- aurs: skip_upload: '{{ not (env "AUR_SSH_KEY") }}'
- chocolateys: skip_publish: '{{ not (env "CHOCOLATEY_API_KEY") }}'

These publishers will automatically activate when secrets are added,
but releases succeed without them.

Changes:
- Add skip_upload to aurs configuration
- Change winget skip_upload from "auto" to env check
- Change chocolatey skip_publish from false to env check

Result:
- Releases succeed without optional publisher secrets
- Publishers automatically activate when secrets are configured
- No manual changes needed when adding secrets
@claude
Copy link
Copy Markdown

claude bot commented Nov 25, 2025

Clean fix. Ship it.

Three skip conditions added correctly. GoReleaser template syntax is right: {{ not (env "VAR") }} checks presence, not truth value.

One note on line 235 (.goreleaser.yaml:235): Changed from skip_upload: auto to env check. Verify auto didn't provide other useful behavior beyond existence check. If auto handles missing token differently (e.g., fallback logic), this changes that behavior.

Otherwise: minimal, solves #155, follows conventional commits.

@claude
Copy link
Copy Markdown

claude bot commented Nov 25, 2025

Critical Issue: PR doesn't match description

The diff shows skip_upload: false (.goreleaser.yaml:66, :235), but description claims env checks were added. This won't fix #155.

Current (wrong):

skip_upload: false

Required:

skip_upload: '{{ not (env "WINGET_GITHUB_TOKEN") }}'  # winget
skip_upload: '{{ not (env "AUR_SSH_KEY") }}'          # aurs
skip_publish: '{{ not (env "CHOCOLATEY_API_KEY") }}' # chocolateys

Setting false forces upload without secrets → same failures.

@wkoszek wkoszek merged commit ac15271 into main Nov 25, 2025
2 checks passed
@wkoszek wkoszek deleted the issue/155 branch November 25, 2025 08:28
wkoszek added a commit that referenced this pull request Nov 25, 2025
## Summary
Add missing environment variables (WINGET_GITHUB_TOKEN and AUR_SSH_KEY)
to the GoReleaser release step.

## Problem
The secrets are configured in GitHub but weren't being passed as
environment variables to GoReleaser, causing template errors:
```
* winget: map has no entry for key "WINGET_GITHUB_TOKEN"
* arch user repositories: map has no entry for key "AUR_SSH_KEY"
```

## Root Cause
GitHub secrets are NOT automatically exposed as environment variables.
They must be explicitly passed in the workflow's `env:` section.

PR #156 added the skip conditions, but the secrets still need to be
passed to GoReleaser.

## Solution
Explicitly pass the secrets as environment variables to the GoReleaser
step:

```yaml
env:
  WINGET_GITHUB_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}
  AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
```

## Changes
Added to GoReleaser release step `env:`:
- WINGET_GITHUB_TOKEN
- AUR_SSH_KEY

These join the existing:
- GITHUB_TOKEN
- TAP_GITHUB_TOKEN  
- CHOCOLATEY_API_KEY

## Result
GoReleaser can now access all required secrets for publishing to:
- ✅ GitHub Releases
- ✅ Homebrew
- ✅ Chocolatey
- ✅ winget
- ✅ AUR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make winget and AUR publishing optional when secrets not configured

1 participant