Skip to content

Commit

Permalink
fix: always restore cache after Nix install
Browse files Browse the repository at this point in the history
This fixes cache restoration on Macs, but shouldn't harm anything on
Linux either, so to keep the logic simple just do it after on both
systems.
  • Loading branch information
nrdxp committed Jan 17, 2023
1 parent 1d591f6 commit f8d5a78
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
21 changes: 10 additions & 11 deletions discover/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ outputs:
runs:
using: "composite"
steps:
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v21
if: startsWith(runner.name, 'discovery') == false
with:
nix_conf: |
experimental-features = nix-command flakes
accept-flake-config = true
trusted-users = runner
access-tokens = github.com=${{ inputs.github_pat }}
- name: Cache Nix Store
id: cache-nix
if: startsWith(runner.name, 'discovery') == false
Expand All @@ -32,17 +42,6 @@ runs:
discovery-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}-
discovery-${{ runner.os }}-${{ runner.arch }}-
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v21
if: startsWith(runner.name, 'discovery') == false
with:
nix_conf: |
experimental-features = nix-command flakes
accept-flake-config = true
trusted-users = runner
access-tokens = github.com=${{ inputs.github_pat }}
- name: Discover
id: eval
env:
Expand Down
13 changes: 1 addition & 12 deletions run/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@ runs:
sudo chmod 0600 ~/.ssh/known_hosts
shell: bash

- name: Restore Cache & Discovery Results
id: restore-cache
if: inputs.discovery_ssh == 'none' && runner.os != 'macOS'
uses: divnix/[email protected]
with:
path: |
/nix
~/.cache/nix
~root/.cache/nix
key: discovery-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}-${{ github.sha }}

- name: Install Nix
uses: nixbuild/nix-quick-install-action@v21
with:
Expand All @@ -98,7 +87,7 @@ runs:
- name: Restore Cache & Discovery Results
id: restore-cache-mac
if: inputs.discovery_ssh == 'none' && runner.os == 'macOS'
if: inputs.discovery_ssh == 'none'
uses: divnix/[email protected]
with:
path: |
Expand Down

0 comments on commit f8d5a78

Please sign in to comment.