Skip to content

Fix cache restore issues #21

Fix cache restore issues

Fix cache restore issues #21

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
os:
- ubuntu/noble
version:
- 1.33.1
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: uv sync
- run: sudo apt update && sudo apt install -y $(uv run bindep -b)
- uses: winterjung/split@7f51d99e7cc1f147f6f99be75acf5e641930af88 # v2.1.0
id: split
with:
msg: ${{ matrix.os }}
separator: "/"
- name: Create .cache directory so it doesn't get created with incorrect ownership
run: mkdir -p ~/.cache
if: ${{ steps.split.outputs._0 == 'ubuntu' }}
- name: Set image filename env var
run: echo "IMAGE_NAME=${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ matrix.version }}" >> "$GITHUB_ENV"
- uses: actions/cache@v4
with:
path: /home/runner/.cache/image-create
key: ${{ env.IMAGE_NAME }}-${{ github.head_ref || github.ref_name }}
restore-keys: |
${{ env.IMAGE_NAME }}-${{ github.head_ref || github.ref_name }}
${{ env.IMAGE_NAME }}
${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}
- run: uv run disk-image-create -o "${IMAGE_NAME}.qcow2" vm block-device-efi ${{ steps.split.outputs._0 }} kubernetes
env:
ELEMENTS_PATH: ${{ github.workspace }}/elements
DIB_RELEASE: ${{ steps.split.outputs._1 }}
DIB_KUBERNETES_VERSION: ${{ matrix.version }}
DIB_MIN_TMPFS: "4"
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.IMAGE_NAME }}.qcow2
if-no-files-found: error
retention-days: 7
- name: Upload image to release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
files: ${{ env.IMAGE_NAME }}.qcow2