-
Notifications
You must be signed in to change notification settings - Fork 0
build: build dist/ at release time instead of committing it to main
#842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| dist/* linguist-generated=true | ||
| dist/index.js* -diff | ||
| dist/** -diff linguist-generated=true |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,39 +3,75 @@ name: Release | |||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||||||||
| - 'v*' | ||||||||||||||||||||||||||||||||||
| - 'v[0-9]+.[0-9]+.[0-9]+' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||
| group: release-${{ github.ref }} | ||||||||||||||||||||||||||||||||||
| cancel-in-progress: false | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| release: | ||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Resolve tag info | ||||||||||||||||||||||||||||||||||
| id: tag | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| TAG="${GITHUB_REF#refs/tags/}" | ||||||||||||||||||||||||||||||||||
| MAJOR=$(echo "$TAG" | grep -oE '^v[0-9]+') | ||||||||||||||||||||||||||||||||||
| echo "tag=$TAG" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||
| echo "major=$MAJOR" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Check whether tag already has built dist/ | ||||||||||||||||||||||||||||||||||
| id: check | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| if git ls-tree -r HEAD --name-only | grep -q '^dist/'; then | ||||||||||||||||||||||||||||||||||
| echo "has_dist=true" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||
| echo "has_dist=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||
| if: steps.check.outputs.has_dist == 'false' | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
| node-version: '24' | ||||||||||||||||||||||||||||||||||
| cache: 'npm' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - run: npm ci | ||||||||||||||||||||||||||||||||||
| - run: npm run build | ||||||||||||||||||||||||||||||||||
| - if: steps.check.outputs.has_dist == 'false' | ||||||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Update floating major tag | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| TAG="${GITHUB_REF#refs/tags/}" | ||||||||||||||||||||||||||||||||||
| MAJOR=$(echo "$TAG" | grep -oE '^v[0-9]+') | ||||||||||||||||||||||||||||||||||
| - if: steps.check.outputs.has_dist == 'false' | ||||||||||||||||||||||||||||||||||
| run: npm run build | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Commit dist/ and rewrite tag to the release commit | ||||||||||||||||||||||||||||||||||
| if: steps.check.outputs.has_dist == 'false' | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| TAG="${{ steps.tag.outputs.tag }}" | ||||||||||||||||||||||||||||||||||
| git config user.name "github-actions[bot]" | ||||||||||||||||||||||||||||||||||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 The 'Commit dist/ and rewrite tag to the release commit' step ends with Suggested fix
Suggested change
AI context{
"file": ".github/workflows/release.yml",
"line": 57,
"severity": "warning",
"confidence": "high",
"flaggedBy": [
"Architecture & Design"
],
"title": "Force-pushing the rewritten tag triggers an unintended second workflow run",
"fix": "# Add as the first step in the job, before 'Resolve tag info':\n- name: Skip bot-triggered reruns\n if: github.actor == 'github-actions[bot]'\n run: |\n echo \"Workflow re-triggered by bot force-push ",
"reachability": "reachable"
} |
||||||||||||||||||||||||||||||||||
| git add -f dist/ | ||||||||||||||||||||||||||||||||||
| git commit -m "release: build artifacts for $TAG" | ||||||||||||||||||||||||||||||||||
| git tag -fa "$TAG" -m "$TAG" | ||||||||||||||||||||||||||||||||||
| git push origin "refs/tags/$TAG" --force | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| git tag -fa "$MAJOR" -m "Update $MAJOR tag to $TAG" | ||||||||||||||||||||||||||||||||||
| git push origin "$MAJOR" --force | ||||||||||||||||||||||||||||||||||
| - name: Update floating major tag | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| TAG="${{ steps.tag.outputs.tag }}" | ||||||||||||||||||||||||||||||||||
| MAJOR="${{ steps.tag.outputs.major }}" | ||||||||||||||||||||||||||||||||||
| git config user.name "github-actions[bot]" | ||||||||||||||||||||||||||||||||||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 📝 Nitpick: MAJOR tag variable not guarded against empty string before git tag In the 'Update floating major tag' step, Suggested fix
Suggested change
AI context{
"file": ".github/workflows/release.yml",
"line": 68,
"severity": "nitpick",
"confidence": "high",
"flaggedBy": [
"Dependencies & Integration"
],
"title": "MAJOR tag variable not guarded against empty string before git tag",
"fix": "Add at the top of the 'Update floating major tag' run block:\n```bash\n[ -n \"$MAJOR\" ] || { echo \"::error::Could not extract major version from tag $TAG\"; exit 1; }\n```",
"tags": [
"defensive-hardening"
],
"reachability": "hypothetical",
"reachabilityReasoning": "The workflow trigger pattern guarantees the tag matches `^v[0-9]+`, so the grep will always produce a non-empty major; no current trigger path produces an empty MAJOR.",
"originalSeverity": "suggestion"
} |
||||||||||||||||||||||||||||||||||
| git tag -fa "$MAJOR" "$TAG" -m "Update $MAJOR tag to $TAG" | ||||||||||||||||||||||||||||||||||
| git push origin "refs/tags/$MAJOR" --force | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Create GitHub Release | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 ✨ Suggestion: Release rerun on existing release does not regenerate notes When Suggested fix
Suggested change
AI context{
"file": ".github/workflows/release.yml",
"line": 72,
"severity": "suggestion",
"confidence": "medium",
"flaggedBy": [
"Dependencies & Integration"
],
"title": "Release rerun on existing release does not regenerate notes",
"fix": "Replace the edit branch with a delete-and-recreate, or add `--generate-notes` to the edit command:\n```bash\ngh release edit \"$TAG\" --title \"$TAG\" --latest --generate-notes\n```\nCaveat: `--generate-notes",
"reachability": "reachable"
} |
||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| TAG="${GITHUB_REF#refs/tags/}" | ||||||||||||||||||||||||||||||||||
| TAG="${{ steps.tag.outputs.tag }}" | ||||||||||||||||||||||||||||||||||
| if gh release view "$TAG" &>/dev/null; then | ||||||||||||||||||||||||||||||||||
| echo "Release $TAG already exists — updating" | ||||||||||||||||||||||||||||||||||
| gh release edit "$TAG" --title "$TAG" --latest | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.js.map | ||
| *.d.ts.map | ||
| .idea/ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 ✨ Suggestion: Removing dist/ from main breaks @main and branch-SHA consumers immediately
Deleting
dist/index.jsfrommainmeans any downstream workflow pinned touses: manki-review/manki@main(or a commit SHA on main) will fail instantly after merge becauseaction.ymlreferencesdist/index.jswhich no longer exists on that ref. The PR description acknowledges 'main stays source-only' but provides no migration path for@mainconsumers — a breaking change that is invisible until their CI fails. Consider adding a deprecation notice or at minimum calling this out in the PR description with an explicit statement that@mainusage is unsupported going forward.Suggested fix
AI context
{ "file": ".github/workflows/release.yml", "line": 1, "severity": "suggestion", "confidence": "high", "flaggedBy": [ "Dependencies & Integration" ], "title": "Removing dist/ from main breaks @main and branch-SHA consumers immediately", "fix": "Add a note to README / USAGE docs stating that @main is no longer a valid ref and consumers must pin to a release tag (e.g., @v5 or @v5.1.2). Optionally leave a stub dist/index.js on main that prints ", "reachability": "reachable" }