@@ -5,32 +5,49 @@ outputs: {}
5
5
runs :
6
6
using : " composite"
7
7
steps :
8
- - name : Install Node.js
9
- uses : actions/setup-node@v3
10
- with :
11
- node-version : 21
8
+ - uses : cachix/install-nix-action@v18
9
+ with :
10
+ install_url : https://releases.nixos.org/nix/nix-2.11.1/install
11
+ - run : |
12
+ source <(nix print-dev-env --show-trace)
13
+ output_file="nix-env.txt"
12
14
13
- - uses : pnpm/action-setup@v2
14
- name : Install pnpm
15
- id : pnpm-install
16
- with :
17
- version : 8
18
- run_install : false
15
+ # Clear the output file
16
+ > $output_file
19
17
20
- - name : Get pnpm store directory
21
- id : pnpm-cache
22
- shell : bash
23
- run : |
24
- echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
18
+ # Loop over each variable in the environment
19
+ while IFS='=' read -r -d '' name value; do
20
+ # Skip if the variable is a function or read-only or non-alphanumeric
21
+ [[ "$(declare -p $name)" =~ "declare -[a-z]*r[a-z]* " ]] && continue
22
+ [[ ! $name =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] && continue
25
23
26
- - uses : actions/cache@v3
27
- name : Setup pnpm cache
28
- with :
29
- path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
30
- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
31
- restore-keys : |
32
- ${{ runner.os }}-pnpm-store-
24
+ # Check if the variable value contains a newline
25
+ if [[ "$value" != *$'\n'* ]]; then
26
+ # It doesn't, so write the variable and its value (stripping quotes) to the file
27
+ echo "${name}=${value//\"/}" >> $output_file
28
+ fi
29
+ done < <(env -0)
33
30
34
- - name : Install dependencies
35
- shell : bash
36
- run : pnpm install
31
+ # useful for debugging what env is exported
32
+ # cat nix-env.txt
33
+ shell: bash
34
+ - run : cat nix-env.txt >> "$GITHUB_ENV"
35
+ shell : bash
36
+
37
+ - name : Get pnpm store directory
38
+ id : pnpm-cache
39
+ shell : bash
40
+ run : |
41
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
42
+
43
+ - uses : actions/cache@v3
44
+ name : Setup pnpm cache
45
+ with :
46
+ path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
47
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
48
+ restore-keys : |
49
+ ${{ runner.os }}-pnpm-store-
50
+
51
+ - name : Install dependencies
52
+ shell : bash
53
+ run : pnpm install
0 commit comments