use variables for setting path: key when using actions/cache ?
i'm attempting to cache the homebrew packages for my repo using the actions/cache github action in my workflow file. i use different runners for my project, ie. the arm64 macos runner, and the legacy amd64 / intel macos runners. with homebrew installed on macos arm, the default prefix ie. $(brew --prefix) is /opt/homebrew whereas on intel macs, the default homebrew prefix is /usr/local
i attempted to use the below step in my workflow file to setup some vars to be used throughout my workflow however i don't think this action actions/cache supports using variables stored in the GITHUB_ENV from what i have been trying.
- name: set brew prefix & cache paths
id: set-brew-prefix-and-cache-paths
run: |
bp=$(brew --prefix)
hbc="$bp/cache"
echo "bp=\"$bp\"" >> "$GITHUB_OUTPUT"
echo "hbc=\"$hbc\"" >> "$GITHUB_OUTPUT"
echo "bp=\"$bp\"" >> "$GITHUB_ENV"
echo "hbc=\"$hbc\"" >> "$GITHUB_ENV"
- name: save homebrew install
uses: actions/cache@v2
env:
bp: ${{ steps.set-brew-prefix-and-cache-paths.outputs.bp }}
with:
#----
# NO WORK!
# path: $(brew --prefix)
#----
# NO WORK!
path: $bp
#----
# NO WORK!
# path: ${{ env.bp }} # does not properly save /opt/homebrew on macos arm64
#----
# key: ${{ env.cache-key }}
# key: ${{ env.envHash }}-freecad-deps-${{ runner.os }}-brew
# key: homebrew-packages-${{ runner.os }}-${{ github.run_id }}
# key: ${{ steps.cache-brewdeps-restore.outputs.cache-primary-key }}
key: ${{ runner.os }}-brewdeps
the only way i've been able to properly save a cache is to use a literal path ie. /opt/homebrew
does this action not support the use of variables when setting the path: key?