Cache Warm #108
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: Cache Warm | |
| # Keep registry cache warm for faster PR and release builds | |
| # Registry cache is branch-agnostic - shared across all workflows | |
| on: | |
| schedule: | |
| # Run daily at 3 AM UTC to keep cache fresh | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| env: | |
| REGISTRY: ghcr.io | |
| CACHE_REPO: ${{ github.repository_owner }}/trmnl-ha-cache | |
| jobs: | |
| warm-docker-cache: | |
| name: Warm Docker Cache | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| tag: amd64 | |
| - platform: linux/arm64 | |
| tag: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Warm Docker layer cache | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: trmnl-ha | |
| platforms: ${{ matrix.platform }} | |
| push: false | |
| cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.CACHE_REPO }}:${{ matrix.tag }} | |
| cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.CACHE_REPO }}:${{ matrix.tag }},mode=max | |
| provenance: false | |
| warm-bun-cache: | |
| name: Warm Bun Cache | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: bun-${{ runner.os }}-${{ hashFiles('trmnl-ha/ha-trmnl/bun.lock') }} | |
| restore-keys: bun-${{ runner.os }}- | |
| - name: Install dependencies | |
| working-directory: trmnl-ha/ha-trmnl | |
| run: bun install |