Skip to content

Commit

Permalink
Use magic-nix-cache-action
Browse files Browse the repository at this point in the history
This should remove the need to manually check if the build output exists
in the cachix cache since it would be restored from the GitHub Actions
cache instead and therefore exists locally already.
  • Loading branch information
matrss committed Feb 9, 2024
1 parent ad0fe1a commit 8d5a558
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/build-flake-outputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
accept-flake-config = true
always-allow-substitutes = true
${{ startsWith(matrix.os, 'ubuntu') && 'extra-platforms = aarch64-linux' || ' ' }}
- uses: DeterminateSystems/magic-nix-cache-action@v3
- uses: cachix/cachix-action@v14
with:
name: matrss
Expand All @@ -61,21 +62,7 @@ jobs:
} 3>&1
)
echo "drv=$drv" >> "$GITHUB_ENV"
- name: Get output hash
run: |
hash=$(nix derivation show $drv^* | jq -r ".\"$drv\".outputs.out.path" | cut -d/ -f4 | cut -d- -f1)
echo "hash=$hash" >> "$GITHUB_ENV"
- name: Check if output is cached
run: |
is_cached() {
curl --fail "https://matrss.cachix.org/$hash.narinfo" > /dev/null 2>&1
}
if is_cached $hash; then
echo "output is cached, nothing to do"
echo "skip_build=true" >> "$GITHUB_ENV"
fi
- name: Build output
if: ${{ env.skip_build != 'true' }}
run: nix build -L $drv^*
- name: Check if there were warnings
if: ${{ github.ref != 'refs/heads/main' }}
Expand Down

0 comments on commit 8d5a558

Please sign in to comment.