Nightly Version Update #158
Workflow file for this run
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: Nightly Version Update | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" # Runs every night at midnight UTC | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'yarn' | |
| - name: Install Aztec CLI | |
| run: | | |
| curl -s https://install.aztec.network > tmp.sh | |
| bash tmp.sh <<< yes "yes" | |
| - name: Update path | |
| run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH | |
| - name: Fetch latest release | |
| id: latest | |
| run: | | |
| latest=$(node .github/scripts/fetchRelease.js) | |
| echo "latest=$latest" >> $GITHUB_OUTPUT | |
| - name: Get current version | |
| id: current | |
| run: | | |
| current=$(grep -oP 'tag\s*=\s*"\K[^\"]+' Nargo.toml | head -1) | |
| echo "current=$current" >> $GITHUB_OUTPUT | |
| - name: Set up Aztec for latest version | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| run: | | |
| tag=${{ steps.latest.outputs.latest }} | |
| echo "TAG=$tag" >> $GITHUB_ENV | |
| aztec-up -v ${tag#v} | |
| - name: Run yarn update | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| run: yarn update | |
| - name: Update sandbox workflow version | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| run: | | |
| sed -i "s/VERSION=[0-9.]*/VERSION=${TAG#v}/" .github/workflows/sandbox.yaml | |
| - name: Clean up temporary files | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| run: rm -f tmp.sh | |
| - name: Commit changes | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| run: | | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git config user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "chore: update to ${{ steps.latest.outputs.latest }}" || echo "No changes" | |
| - name: Create Pull Request | |
| if: steps.latest.outputs.latest != steps.current.outputs.current | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.ACCESS_TOKEN }} | |
| branch: nightly/update-${{ steps.latest.outputs.latest }} | |
| title: "Update to ${{ steps.latest.outputs.latest }}" | |
| body: "Automated nightly update to aztec-packages ${{ steps.latest.outputs.latest }}" | |
| commit-message: "chore: update to ${{ steps.latest.outputs.latest }}" | |
| notify-failure: | |
| needs: update | |
| runs-on: ubuntu-latest | |
| if: failure() | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.ACCESS_TOKEN }} | |
| script: | | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: 'Nightly update failed', | |
| body: '@critesjosh The nightly update workflow failed. Please investigate.' | |
| }) | |