ci: build and upload prebuilt assets on push - #2372
Conversation
Build JS/CSS + the Vue SPA on every push to develop/main/version-*, package the app's public/ output into crm-assets.tar.gz, and upload it to a rolling assets-<branch> prerelease. Lets bench tooling download prebuilt assets instead of building from source on every setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Tick the box to add this pull request to the merge queue (same as
|
Confidence Score: 4/5The new workflow can fail before producing assets on normal branch pushes.
.github/workflows/build-and-commit-assets.yml
|
| Filename | Overview |
|---|---|
| .github/workflows/build-and-commit-assets.yml | Adds the rolling asset build/upload workflow; branch checkout, dependency install, and release upload paths need fixes. |
Prompt To Fix All With AI
Fix the following 5 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 5
.github/workflows/build-and-commit-assets.yml:31
**Frappe Ref Can Be Missing**
A push to `main` or a `version-*` CRM branch checks out `frappe/frappe` with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.
### Issue 2 of 5
.github/workflows/build-and-commit-assets.yml:57
**Frontend Dependencies Stay Uninstalled**
This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under `frontend/`. The later root `yarn build` only runs `cd frontend && yarn build`, so a fresh runner reaches the SPA build without `frontend/node_modules` and fails on missing Vite/Vue packages.
### Issue 3 of 5
.github/workflows/build-and-commit-assets.yml:81
**Branch Tag Mapping Collides**
The tag name replaces `/` with `-`, so two valid matching branches such as `version-15/hotfix` and `version-15-hotfix` both upload to `assets-version-15-hotfix`. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.
### Issue 4 of 5
.github/workflows/build-and-commit-assets.yml:82
**Release Tag Uses Default Branch**
On the first upload for a branch, `gh release create` is called without `--target`, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.
### Issue 5 of 5
.github/workflows/build-and-commit-assets.yml:83
**Cancelled Upload Can Drop Asset**
Rapid pushes to the same branch cancel the older run, and `gh release upload --clobber` deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without `crm-assets.tar.gz`, so benches cannot download prebuilt assets.
Reviews (1): Last reviewed commit: "ci: build and upload assets to rolling r..." | Re-trigger Greptile
| - uses: actions/checkout@v4 | ||
| with: | ||
| repository: frappe/frappe | ||
| path: apps/frappe |
There was a problem hiding this comment.
A push to main or a version-* CRM branch checks out frappe/frappe with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 31
Comment:
**Frappe Ref Can Be Missing**
A push to `main` or a `version-*` CRM branch checks out `frappe/frappe` with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.
**Context Used:** AGENTS.md ([source](https://app.greptile.com/frappe/github/frappe/crm/-/custom-context?memory=242c238f-7e68-48c9-88da-fba50847b5c5))
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| - name: Install crm JS dependencies | ||
| working-directory: apps/crm | ||
| run: yarn install --frozen-lockfile |
There was a problem hiding this comment.
Frontend Dependencies Stay Uninstalled
This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under frontend/. The later root yarn build only runs cd frontend && yarn build, so a fresh runner reaches the SPA build without frontend/node_modules and fails on missing Vite/Vue packages.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 57
Comment:
**Frontend Dependencies Stay Uninstalled**
This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under `frontend/`. The later root `yarn build` only runs `cd frontend && yarn build`, so a fresh runner reaches the SPA build without `frontend/node_modules` and fails on missing Vite/Vue packages.
**Context Used:** AGENTS.md ([source](https://app.greptile.com/frappe/github/frappe/crm/-/custom-context?memory=242c238f-7e68-48c9-88da-fba50847b5c5))
How can I resolve this? If you propose a fix, please make it concise.| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG="assets-${GITHUB_REF_NAME//\//-}" |
There was a problem hiding this comment.
The tag name replaces / with -, so two valid matching branches such as version-15/hotfix and version-15-hotfix both upload to assets-version-15-hotfix. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 81
Comment:
**Branch Tag Mapping Collides**
The tag name replaces `/` with `-`, so two valid matching branches such as `version-15/hotfix` and `version-15-hotfix` both upload to `assets-version-15-hotfix`. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.
How can I resolve this? If you propose a fix, please make it concise.| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG="assets-${GITHUB_REF_NAME//\//-}" | ||
| gh release create "$TAG" -R "$GITHUB_REPOSITORY" --prerelease --title "Assets: $GITHUB_REF_NAME" --notes "" 2>/dev/null || true |
There was a problem hiding this comment.
Release Tag Uses Default Branch
On the first upload for a branch, gh release create is called without --target, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 82
Comment:
**Release Tag Uses Default Branch**
On the first upload for a branch, `gh release create` is called without `--target`, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.
How can I resolve this? If you propose a fix, please make it concise.| run: | | ||
| TAG="assets-${GITHUB_REF_NAME//\//-}" | ||
| gh release create "$TAG" -R "$GITHUB_REPOSITORY" --prerelease --title "Assets: $GITHUB_REF_NAME" --notes "" 2>/dev/null || true | ||
| gh release upload "$TAG" -R "$GITHUB_REPOSITORY" crm-assets.tar.gz --clobber |
There was a problem hiding this comment.
Cancelled Upload Can Drop Asset
Rapid pushes to the same branch cancel the older run, and gh release upload --clobber deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without crm-assets.tar.gz, so benches cannot download prebuilt assets.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 83
Comment:
**Cancelled Upload Can Drop Asset**
Rapid pushes to the same branch cancel the older run, and `gh release upload --clobber` deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without `crm-assets.tar.gz`, so benches cannot download prebuilt assets.
How can I resolve this? If you propose a fix, please make it concise.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2372 +/- ##
===========================================
- Coverage 60.56% 60.53% -0.03%
===========================================
Files 142 142
Lines 8550 8550
===========================================
- Hits 5178 5176 -2
- Misses 3372 3374 +2 🚀 New features to boost your workflow:
|
Builds JS/CSS + the Vue SPA on push to develop/main/version-* and uploads them as a rolling
assets-<branch>release, so benches can download prebuilt assets instead of building from source. Same setup as frappe/erpnext/hrms.