Update EUVlok Packages #1040
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 EUVlok Packages | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "17 */8 * * *" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: update-pkgs-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| update-packages: | |
| name: Update Packages (${{ matrix.platform }}) | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| max-parallel: 1 | |
| matrix: | |
| include: | |
| - platform: linux | |
| runs-on: ubuntu-latest | |
| - platform: darwin | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Nix | |
| uses: ./.github/actions/setup-nix | |
| - name: Configure git identity | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Sync latest branch state | |
| run: git pull --rebase origin "${{ github.ref_name }}" | |
| - name: Update flake inputs | |
| run: | | |
| nix flake update | |
| if ! git diff --quiet flake.lock; then | |
| git add flake.lock | |
| git commit -m "flake.lock: update" | |
| fi | |
| - name: Update packages | |
| uses: ./.github/actions/update-packages | |
| with: | |
| platform: ${{ matrix.platform }} | |
| - name: Push | |
| shell: bash | |
| run: |- | |
| set -euo pipefail | |
| if git diff --quiet "origin/${{ github.ref_name }}..HEAD"; then | |
| printf "::notice::No commits to push\n" | |
| exit 0 | |
| fi | |
| for i in {1..5}; do | |
| if git push origin "HEAD:${{ github.ref_name }}"; then | |
| printf "::notice::Successfully pushed changes on attempt %d\n" "$i" | |
| exit 0 | |
| fi | |
| printf "::warning::Push failed on attempt %d, retrying...\n" "$i" | |
| git pull --rebase origin "${{ github.ref_name }}" | |
| sleep $((5 * i)) | |
| done | |
| printf "::error::Failed to push after 5 attempts\n" | |
| exit 1 |