diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bce0b0d6..cee6ef65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,11 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - - id: go-cache-paths - run: | - echo "::set-output name=go-build::$(go env GOCACHE)" - echo "::set-output name=go-mod::$(go env GOMODCACHE)" - - uses: actions/checkout@v2 with: fetch-depth: 2 @@ -33,6 +28,24 @@ jobs: integration_test/ config-example.yaml + - uses: actions/cache@v3 + if: steps.changed-files.outputs.any_changed == 'true' + with: + path: | + /nix + key: ${{ runner.os }}-nix-${{ hashFiles('**/flake.lock') }} + restore-keys: | + ${{ runner.os }}-nix- + + - uses: cachix/install-nix-action@v16 + if: steps.changed-files.outputs.any_changed == 'true' + + - id: go-cache-paths + if: steps.changed-files.outputs.any_changed == 'true' + run: | + echo "::set-output name=go-build::$(nix develop --command -- go env GOCACHE)" + echo "::set-output name=go-mod::$(nix develop --command -- go env GOMODCACHE)" + - name: Go Build Cache uses: actions/cache@v3 if: steps.changed-files.outputs.any_changed == 'true' @@ -43,25 +56,14 @@ jobs: ${{ runner.os }}-go-build- - name: Go Mod Cache - uses: actions/cache@v2 + uses: actions/cache@v3 + if: steps.changed-files.outputs.any_changed == 'true' with: path: ${{ steps.go-cache-paths.outputs.go-mod }} key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-mod- - - uses: cachix/install-nix-action@v16 - if: steps.changed-files.outputs.any_changed == 'true' - - - uses: actions/cache@v3 - if: steps.changed-files.outputs.any_changed == 'true' - with: - path: | - /nix - key: ${{ runner.os }}-nix-${{ hashFiles('**/flake.lock') }} - restore-keys: | - ${{ runner.os }}-nix- - - name: Run build if: steps.changed-files.outputs.any_changed == 'true' run: nix build