workflow: always() cache

This commit is contained in:
cy 2025-03-17 21:38:31 -04:00
parent 54af66d26c
commit d50d2dcb73
Signed by: cy
SSH key fingerprint: SHA256:o/geVWV4om1QhUSkKvDQeW/eAihwnjyXkqMwrVdbuts
2 changed files with 14 additions and 5 deletions

View file

@ -63,13 +63,17 @@ jobs:
run: |
nix profile install github:zhaofengli/attic
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
- name: build and cache
- name: build
run: |
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
nix build -L "$package"
- name: cache
if: always()
run: |
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
derivation="$(nix path-info --derivation "$package")"
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
attic push main --stdin <<< "$cache"
xargs attic push main <<< "$cache"
build-homes:
strategy:
fail-fast: false
@ -119,10 +123,14 @@ jobs:
run: |
nix profile install github:zhaofengli/attic
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
- name: build and cache
- name: build
run: |
package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
nix build -L "$package"
- name: cache
if: always()
run: |
package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
derivation="$(nix path-info --derivation "$package")"
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
attic push main --stdin <<< "$cache"
xargs attic push main <<< "$cache"