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