Set up Snap and Winget distribution workflows#41
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideAdds automated Snap and Winget distribution pipelines plus documentation, a Winget manifest generator script, and initial 0.0.102 Winget manifests, and updates Snap packaging to derive the release version at build time from tags/package.json. Sequence diagram for Winget manifest generation and update submissionsequenceDiagram
actor Dev
participant GitHub as GitHub_Releases
participant WingetWF as Workflow_winget_yml
participant GenJob as Job_generate_manifests
participant Script as generate_winget_manifest_ts
participant Artifacts as GitHub_Artifacts
participant UpdateJob as Job_submit_update
participant WingetCreate as wingetcreate
participant WingetPkgs as microsoft_winget_pkgs
Dev->>GitHub: Publish tagged release vX_Y_Z
GitHub-->>WingetWF: Trigger on release.published
WingetWF->>GenJob: Start job generate-manifests
GenJob->>GitHub: Resolve tag, version, installer_url, checksums_url
GenJob->>GitHub: Download checksums-windows.txt
GenJob->>Script: bun run release:winget -- version, installer-url, checksums-file, installer-file
Script->>Script: Read checksum from file
Script->>Script: Create version, locale, installer YAML manifests
Script-->>GenJob: Write manifests under packaging/winget/manifests/version
GenJob->>GenJob: Archive manifests to winget-manifests-<version>.tar.gz
GenJob->>Artifacts: Upload artifact
GenJob->>GitHub: Upload archive to release assets
GenJob-->>WingetWF: Output tag, version, installer_url
Note over WingetWF,UpdateJob: submit-update job is conditional on WINGET_PACKAGE_READY and WINGET_CREATE_GITHUB_TOKEN
WingetWF->>UpdateJob: Start job submit-update
UpdateJob->>WingetCreate: Install dependencies (VCLibs, wingetcreate)
UpdateJob->>WingetCreate: wingetcreate update RemcoStoeten_Dora -u installer_url -v version -t WINGET_CREATE_GITHUB_TOKEN --submit
WingetCreate->>WingetPkgs: Create update PR
WingetPkgs-->>Dev: PR visible for review/merge
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughIntroduces packaging and distribution infrastructure for multiple platforms. Adds GitHub Actions workflows for Snap and Winget packaging, corresponding configuration files, documentation guides, a utility script for generating Winget manifests, and example manifest files. Enables automated building, uploading, and publishing to distribution channels. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub<br/>(Release)
participant GA as GitHub<br/>Actions
participant SC as Snapcraft<br/>Build
participant GR as GitHub<br/>Release
participant SS as Snap<br/>Store
GH->>GA: Trigger on<br/>release.published
GA->>GA: Resolve tag,<br/>version
GA->>SC: Build snap<br/>(snapcore/action-build)
SC-->>GA: .snap artifact
GA->>GR: Upload .snap<br/>to release
alt Credentials present
GA->>SS: Publish snap<br/>to store
SS-->>GA: Published
end
GA-->>GH: Workflow complete
sequenceDiagram
participant GH as GitHub<br/>(Release/Dispatch)
participant GA as GitHub<br/>Actions
participant WM as Winget<br/>Manifest Gen
participant GR as GitHub<br/>Release
participant WP as Winget-pkgs<br/>(microsoft/repo)
GH->>GA: Trigger on<br/>release.published
GA->>GA: Resolve tag,<br/>version
GA->>WM: Generate manifests<br/>(3 YAML files)
WM-->>GA: Manifests
GA->>GA: Archive to<br/>.tar.gz
GA->>GR: Upload archive<br/>to release
alt Submit enabled &<br/>credentials present
GA->>WP: Submit update<br/>via wingetcreate
WP-->>GA: PR created
end
GA-->>GH: Workflow complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In
snap/snapcraft.yamltheversion: '0.0.102'field will quickly drift from the dynamically set version in the Snap workflow (craftctl set version=$DORA_RELEASE_VERSION); consider changing the manifest to use a placeholder (e.g.git) or a neutral value and rely solely on the workflow-set version to avoid mismatches between the snap metadata and the actual release tag.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `snap/snapcraft.yaml` the `version: '0.0.102'` field will quickly drift from the dynamically set version in the Snap workflow (`craftctl set version=$DORA_RELEASE_VERSION`); consider changing the manifest to use a placeholder (e.g. `git`) or a neutral value and rely solely on the workflow-set version to avoid mismatches between the snap metadata and the actual release tag.
## Individual Comments
### Comment 1
<location path="tools/scripts/generate-winget-manifest.ts" line_range="50-51" />
<code_context>
+ .map((line) => line.trim())
+ .filter(Boolean)
+
+ for (const line of lines) {
+ const [hash, relativePath] = line.split(/\s{2,}/)
+ if (!hash || !relativePath) {
+ continue
</code_context>
<issue_to_address>
**issue (bug_risk):** Splitting checksums on 2+ spaces may fail for common single-space checksum formats.
`sha256sum`-style files are often `HASH<space>FILENAME`, `HASH<space><space>FILENAME`, or include tabs. Requiring 2+ whitespace characters (`/\s{2,}/`) will miss valid single-space lines and incorrectly hit the `Could not find ...` path. Using a more flexible split (e.g. `line.split(/\s+/)` or `const [hash, ...rest] = line.split(/\s+/); const relativePath = rest.join(' ');`) would handle the common checksum formats reliably.
</issue_to_address>
### Comment 2
<location path=".github/workflows/winget.yml" line_range="82-85" />
<code_context>
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: gh release upload ${{ steps.meta.outputs.tag }} winget-manifests-${{ steps.meta.outputs.version }}.tar.gz --clobber
+
+ submit-update:
+ needs: generate-manifests
+ if: ${{ (github.event_name == 'release' && vars.WINGET_PACKAGE_READY == 'true') || (github.event_name == 'workflow_dispatch' && inputs.submit_update) }}
+ runs-on: windows-latest
+ env:
+ WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
</code_context>
<issue_to_address>
**suggestion (performance):** The submit-update job always allocates a Windows runner even when the Winget token is missing.
Because the job always runs on `windows-latest`, it still allocates a Windows runner even when `WINGET_CREATE_GITHUB_TOKEN` is empty and the first step exits immediately. Consider moving the token check into the job-level `if:` (e.g. append `&& secrets.WINGET_CREATE_GITHUB_TOKEN != ''`) so the job is entirely skipped when the token isn’t configured.
Suggested implementation:
```
submit-update:
needs: generate-manifests
if: ${{ ((github.event_name == 'release' && vars.WINGET_PACKAGE_READY == 'true') || (github.event_name == 'workflow_dispatch' && inputs.submit_update)) && secrets.WINGET_CREATE_GITHUB_TOKEN != '' }}
runs-on: windows-latest
env:
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
```
```
steps:
- name: Install WingetCreate dependencies
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| for (const line of lines) { | ||
| const [hash, relativePath] = line.split(/\s{2,}/) |
There was a problem hiding this comment.
issue (bug_risk): Splitting checksums on 2+ spaces may fail for common single-space checksum formats.
sha256sum-style files are often HASH<space>FILENAME, HASH<space><space>FILENAME, or include tabs. Requiring 2+ whitespace characters (/\s{2,}/) will miss valid single-space lines and incorrectly hit the Could not find ... path. Using a more flexible split (e.g. line.split(/\s+/) or const [hash, ...rest] = line.split(/\s+/); const relativePath = rest.join(' ');) would handle the common checksum formats reliably.
| submit-update: | ||
| needs: generate-manifests | ||
| if: ${{ (github.event_name == 'release' && vars.WINGET_PACKAGE_READY == 'true') || (github.event_name == 'workflow_dispatch' && inputs.submit_update) }} | ||
| runs-on: windows-latest |
There was a problem hiding this comment.
suggestion (performance): The submit-update job always allocates a Windows runner even when the Winget token is missing.
Because the job always runs on windows-latest, it still allocates a Windows runner even when WINGET_CREATE_GITHUB_TOKEN is empty and the first step exits immediately. Consider moving the token check into the job-level if: (e.g. append && secrets.WINGET_CREATE_GITHUB_TOKEN != '') so the job is entirely skipped when the token isn’t configured.
Suggested implementation:
submit-update:
needs: generate-manifests
if: ${{ ((github.event_name == 'release' && vars.WINGET_PACKAGE_READY == 'true') || (github.event_name == 'workflow_dispatch' && inputs.submit_update)) && secrets.WINGET_CREATE_GITHUB_TOKEN != '' }}
runs-on: windows-latest
env:
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
steps:
- name: Install WingetCreate dependencies
Summary
Verification
Summary by Sourcery
Add in-repo support for building and publishing Dora via Snap and Winget, including automation workflows, packaging metadata, and operator documentation.
New Features:
Enhancements:
Summary by CodeRabbit
New Features
Documentation