|
| 1 | +name: Update Hyperlane Dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run weekly on Mondays at 9 AM UTC |
| 6 | + - cron: '0 9 * * 1' |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - pb/auto-update-ci |
| 11 | + |
| 12 | +jobs: |
| 13 | + update-dependencies: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + pull-requests: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + ref: main |
| 24 | + |
| 25 | + - name: Configure Git |
| 26 | + run: | |
| 27 | + git config user.name "GitHub Actions Bot" |
| 28 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 29 | +
|
| 30 | + - name: Setup Node.js 20 |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: 20 |
| 34 | + |
| 35 | + - name: Get latest SDK and Utils versions |
| 36 | + id: get-versions |
| 37 | + run: | |
| 38 | + LATEST_SDK=$(yarn npm info @hyperlane-xyz/sdk --fields version --json | jq -r '.version') |
| 39 | + LATEST_UTILS=$(yarn npm info @hyperlane-xyz/utils --fields version --json | jq -r '.version') |
| 40 | + echo "sdk=$LATEST_SDK" >> $GITHUB_OUTPUT |
| 41 | + echo "utils=$LATEST_UTILS" >> $GITHUB_OUTPUT |
| 42 | + echo "Latest SDK: $LATEST_SDK" |
| 43 | + echo "Latest Utils: $LATEST_UTILS" |
| 44 | +
|
| 45 | + - name: Update package.json with latest versions |
| 46 | + run: | |
| 47 | + npm pkg set devDependencies.@hyperlane-xyz/sdk=${{ steps.get-versions.outputs.sdk }} |
| 48 | + npm pkg set devDependencies.@hyperlane-xyz/utils=${{ steps.get-versions.outputs.utils }} |
| 49 | +
|
| 50 | + - name: Install dependencies |
| 51 | + run: yarn install --no-immutable |
| 52 | + |
| 53 | + - name: Run build |
| 54 | + id: build |
| 55 | + continue-on-error: true |
| 56 | + run: yarn build |
| 57 | + |
| 58 | + - name: Run tests |
| 59 | + id: test |
| 60 | + continue-on-error: true |
| 61 | + run: yarn test:unit |
| 62 | + |
| 63 | + - name: Check for changes and create PR |
| 64 | + if: always() |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + run: | |
| 68 | + if ! git diff --quiet; then |
| 69 | + git checkout -b ci/update-hl-deps |
| 70 | + git add -A |
| 71 | + git commit -m "chore: update Hyperlane deps to SDK ${{ steps.get-versions.outputs.sdk }} and Utils ${{ steps.get-versions.outputs.utils }} |
| 72 | +
|
| 73 | + - Update @hyperlane-xyz/sdk to ${{ steps.get-versions.outputs.sdk }} |
| 74 | + - Update @hyperlane-xyz/utils to ${{ steps.get-versions.outputs.utils }} |
| 75 | + - Update yarn.lock" |
| 76 | +
|
| 77 | + git push -fu origin ci/update-hl-deps |
| 78 | +
|
| 79 | + PR_EXISTS=$(gh pr list --base main --head ci/update-hl-deps --json number --jq length) |
| 80 | + if [ "$PR_EXISTS" -eq "0" ]; then |
| 81 | + gh pr create \ |
| 82 | + --base main \ |
| 83 | + --head ci/update-hl-deps \ |
| 84 | + --title "chore: update Hyperlane SDK and Utils to latest versions" \ |
| 85 | + --body "## Automated Dependency Update |
| 86 | +
|
| 87 | + This PR updates the Hyperlane dependencies to their latest versions. |
| 88 | +
|
| 89 | + **Updated versions:** |
| 90 | + - \`@hyperlane-xyz/sdk\`: \`${{ steps.get-versions.outputs.sdk }}\` |
| 91 | + - \`@hyperlane-xyz/utils\`: \`${{ steps.get-versions.outputs.utils }}\` |
| 92 | +
|
| 93 | + **Changes include:** |
| 94 | + - Updated \`package.json\` with latest SDK and Utils versions |
| 95 | + - Updated \`yarn.lock\` via \`yarn install\` |
| 96 | + - Verified build passes with new versions |
| 97 | + - Verified unit tests pass with new versions |
| 98 | +
|
| 99 | + --- |
| 100 | + 🤖 This PR was automatically generated by the [update-hyperlane-deps workflow](.github/workflows/update-hyperlane-deps.yml)" |
| 101 | + else |
| 102 | + echo "Pull request already exists. Branch updated with latest changes." |
| 103 | + fi |
| 104 | + else |
| 105 | + echo "No changes detected. Skipping PR creation." |
| 106 | + fi |
0 commit comments