From 864b62652b572b94ba24314d2c2b27b2357ed31a Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sun, 8 Jan 2023 00:57:22 -0700 Subject: [PATCH] .github: Allow specifying alternative cache in secrets --- .github/workflows/build.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 520ba50..8fa8a5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,14 +24,22 @@ jobs: trusted-users = root ${{ env.ACTION_USER }} - name: Install Attic - run: ./.github/install-attic-ci.sh + run: | + if ! command -v attic &> /dev/null; then + ./.github/install-attic-ci.sh + fi - name: Configure Attic run: | + : "${ATTIC_SERVER:=https://staging.attic.rs/}" + : "${ATTIC_CACHE:=attic-ci}" + echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV export PATH=$HOME/.nix-profile/bin:$PATH # FIXME - attic login staging https://staging.attic.rs/ "$ATTIC_TOKEN" - attic use attic-ci + attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN" + attic use "$ATTIC_CACHE" env: + ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }} + ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }} ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} - name: Build and run tests @@ -47,7 +55,5 @@ jobs: export PATH=$HOME/.nix-profile/bin:$PATH # FIXME if [ -n "$ATTIC_TOKEN" ]; then nix build .#internal."$system".attic-tests .#internal."$system".cargoArtifacts --no-link --print-out-paths -L | \ - xargs attic push attic-ci + xargs attic push "ci:$ATTIC_CACHE" fi - env: - ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}