Repository navigation
Update Rolldown #240
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
| name: Update Rolldown | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update-rolldown: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| submodules: recursive | |
| persist-credentials: true | |
| - name: Get current submodule tag | |
| id: current | |
| working-directory: rolldown | |
| run: | | |
| git fetch --tags --recurse-submodules=no | |
| tag=$(git describe --tags --exact-match) | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "Current rolldown tag: $tag" | |
| - name: Get latest rolldown tag | |
| id: latest | |
| run: | | |
| tag=$(git ls-remote --tags --sort=-v:refname https://github.com/rolldown/rolldown.git \ | |
| | grep -oP 'refs/tags/\Kv[0-9]+\.[0-9]+\.[0-9]+.*$' \ | |
| | head -n 1) | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "Latest rolldown tag: $tag" | |
| - name: Check if update is needed | |
| id: check | |
| env: | |
| CURRENT_TAG: ${{ steps.current.outputs.tag }} | |
| LATEST_TAG: ${{ steps.latest.outputs.tag }} | |
| run: | | |
| if [ "$CURRENT_TAG" = "$LATEST_TAG" ]; then | |
| echo "Already up to date ($CURRENT_TAG)" | |
| echo "needed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Update available: $CURRENT_TAG -> $LATEST_TAG" | |
| echo "needed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Update submodule to latest tag | |
| if: steps.check.outputs.needed == 'true' | |
| working-directory: rolldown | |
| env: | |
| LATEST_TAG: ${{ steps.latest.outputs.tag }} | |
| run: | | |
| git fetch --tags --recurse-submodules=no | |
| git checkout "$LATEST_TAG" | |
| - name: Setup Rust | |
| if: steps.check.outputs.needed == 'true' | |
| uses: oxc-project/setup-rust@3d6fb132fbe7cdcb66bf8ec193911c2945369d12 # v1.0.17 | |
| with: | |
| cache-key: debug-build | |
| - name: Sync oxc version with rolldown | |
| if: steps.check.outputs.needed == 'true' | |
| run: | | |
| # Extract oxc version from rolldown's resolved dependencies | |
| oxc_version=$(cargo metadata --format-version 1 --manifest-path rolldown/Cargo.toml | jq -r '.packages[] | select(.name == "oxc") | .version') | |
| echo "Rolldown uses oxc $oxc_version" | |
| # Update oxc version in zarara's workspace Cargo.toml | |
| sed -i "s/^oxc = \".*\"/oxc = \"$oxc_version\"/" Cargo.toml | |
| cargo update -p oxc | |
| - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| id: app-token | |
| with: | |
| client-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Create pull request | |
| if: steps.check.outputs.needed == 'true' | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| CURRENT_TAG: ${{ steps.current.outputs.tag }} | |
| LATEST_TAG: ${{ steps.latest.outputs.tag }} | |
| run: | | |
| branch="rolldown-update/$LATEST_TAG" | |
| title="chore: update rolldown to $LATEST_TAG" | |
| # Check if a PR already exists for this branch | |
| existing=$(gh pr list --head "$branch" --json number --jq 'length') | |
| if [ "$existing" -gt 0 ]; then | |
| echo "PR already exists for $branch, skipping" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$branch" | |
| git add rolldown Cargo.toml Cargo.lock | |
| git commit -m "$title" | |
| git push origin "$branch" | |
| gh pr create \ | |
| --title "$title" \ | |
| --body "Automated update of the rolldown submodule from \`$CURRENT_TAG\` to \`$LATEST_TAG\`." \ | |
| --head "$branch" |