@@ -47,37 +47,27 @@ jobs:
47
47
python -c "import os; file = open('nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
48
48
env :
49
49
NIX_SIGN_SECRET_KEY : ${{ secrets.NIX_SIGN_SECRET_KEY }}
50
- - name : Log in to Docker Hub
51
- if : matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
52
- uses : docker/login-action@v2
50
+ - name : Setup cache script
51
+ run : |
52
+ mkdir -p /etc/nix
53
+ cat << 'EOF' | sudo tee /etc/nix/upload-to-cache.sh > /dev/null
54
+ #!/usr/bin/env bash
55
+ set -eouf
56
+ export IFS=' '
57
+ echo /nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=nix-secret-key' \$OUT_PATHS
58
+ EOF
59
+ chmod +x /etc/nix/upload-to-cache.sh
60
+ - name : Install nix
61
+ uses : DeterminateSystems/nix-installer-action@main
53
62
with :
54
- username : ${{ secrets.DOCKER_USERNAME }}
55
- password : ${{ secrets.DOCKER_PASSWORD }}
56
- - name : Build psql bundle with nix
57
- if : matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
58
- run : docker build -t base_nix -f docker/nix/Dockerfile .
59
- - name : Run build psql bundle
60
- if : matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
61
- run : |
62
- docker run -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} \
63
- -e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
64
- -e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
65
- base_nix bash -c "./workspace/docker/nix/build_nix.sh"
66
- - name : Build psql bundle on macos
67
- if : matrix.runner == 'macos-latest' || matrix.runner == 'macos-13'
63
+ extra-conf : |
64
+ substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
65
+ trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
66
+ post-build-hook = /etc/nix/upload-to-cache.sh
67
+ - name : Build psql bundle
68
68
run : |
69
- curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm \
70
- --extra-conf "substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com" \
71
- --extra-conf "trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
72
- . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
73
- cp ./docker/nix/build_nix.sh ./build_nix.sh
74
- sed -i '' '1s|^#!/bin/env bash|#!/usr/bin/env bash|' ./build_nix.sh
75
- chmod +x ./build_nix.sh
76
- ./build_nix.sh
69
+ ./docker/nix/build_nix.sh
77
70
env :
78
71
AWS_ACCESS_KEY_ID : ${{ env.AWS_ACCESS_KEY_ID }}
79
72
AWS_SECRET_ACCESS_KEY : ${{ env.AWS_SECRET_ACCESS_KEY }}
80
73
AWS_SESSION_TOKEN : ${{ env.AWS_SESSION_TOKEN }}
81
-
82
- name : build psql bundle on ${{ matrix.arch }}
83
-
0 commit comments