-
Notifications
You must be signed in to change notification settings - Fork 20
Automate dist regeneration for Rolldown updates #825
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
743d796
Automate dist regeneration for Rolldown updates
amyu 9dea9b5
Use GITHUB_TOKEN for dist updates
amyu 3f83ef6
Remove redundant workflow commentary
amyu e9bfd08
Harden Renovate dist automation
amyu 4e8338a
Restore the package script
amyu b0a3c35
Validate generated dist with dispatched workflows
amyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: Update Renovate dist | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| branches: | ||
| - main | ||
| paths: | ||
| - package.json | ||
| - pnpm-lock.yaml | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| if: >- | ||
| github.event.pull_request.user.login == 'renovate[bot]' && | ||
| github.event.pull_request.user.id == 29139614 && | ||
| github.event.pull_request.head.repo.full_name == github.repository && | ||
| startsWith(github.event.pull_request.head.ref, 'renovate/rolldown-') | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| changed: ${{ steps.diff.outputs.changed }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | ||
| with: | ||
| node-version-file: .node-version | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Rebuild dist | ||
| run: pnpm run all | ||
|
|
||
| - name: Check generated files | ||
| id: diff | ||
| shell: bash | ||
| run: | | ||
| if git diff --quiet -- dist/; then | ||
| echo "changed=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Upload generated dist | ||
| if: steps.diff.outputs.changed == 'true' | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: renovate-dist-${{ github.run_id }} | ||
| path: dist/ | ||
| retention-days: 1 | ||
|
|
||
| update: | ||
| needs: build | ||
| if: needs.build.outputs.changed == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| fetch-depth: 0 | ||
| persist-credentials: true | ||
|
|
||
| - name: Verify pull request head | ||
| shell: bash | ||
| env: | ||
| EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| if [ "$(git rev-parse HEAD)" != "$EXPECTED_HEAD_SHA" ]; then | ||
| echo "The pull request branch changed while dist was being generated." | ||
| echo "A newer workflow run will regenerate dist for the new head." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Download generated dist | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: renovate-dist-${{ github.run_id }} | ||
| path: dist/ | ||
|
|
||
| - name: Commit generated dist | ||
| shell: bash | ||
| env: | ||
| HEAD_BRANCH: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add dist/ | ||
|
|
||
| if git diff --cached --quiet; then | ||
| echo "Generated dist is already up to date." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git commit -m "Regenerate dist for Rolldown update" | ||
| git push origin "HEAD:$HEAD_BRANCH" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Whenever Rolldown changes
dist/, this push uses the persisted repositoryGITHUB_TOKEN; GitHub documents that events caused by that token do not create new workflow runs (Triggering a workflow from a workflow). Consequently, the runs fromcheck-dist.yml,lint.yml, and especially the Android matrix intest.ymlremain associated with the pre-generation SHA, so the newly committed production bundle is never tested and required latest-head checks may remain missing. Push with credentials that trigger workflows, or run the complete downstream validation against the generated commit before updating the branch.Useful? React with 👍 / 👎.