-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
30 lines (30 loc) · 1.07 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: 'Activate Hermit'
description: 'Activate a Hermit environment'
inputs:
working-directory:
description: 'The directory with the Hermit environment (contains `bin/hermit`)'
required: false
default: './'
cache:
description: 'If "true", installed Hermit packages will be cached.'
required: false
default: 'false'
runs:
using: composite
steps:
- if: ${{ inputs.cache == 'true' }}
id: bin-hash
shell: bash
run: |
hash="$(find ./${{ inputs.working-directory }}/bin ! -type d | sort | xargs openssl sha256 | openssl sha256 -r | cut -d' ' -f1)"
echo "hash=$hash" >> "$GITHUB_OUTPUT"
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: ${{ runner.os == 'macOS' && '~/Library/Caches/hermit/pkg' || '~/.cache/hermit/pkg' }}
key: ${{ runner.os }}-hermit-cache-${{ steps.bin-hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-hermit-cache-
- shell: bash
working-directory: ${{ inputs.working-directory }}
run: ./bin/hermit env --raw >> "$GITHUB_ENV"