Skip to content

Commit c7aa7d2

Browse files
committed
Do not use secrets if they are not available
In the forks, secrets are not available.
1 parent d69dafc commit c7aa7d2

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

.github/workflows/nix-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
3232
- name: aws-creds
3333
uses: aws-actions/configure-aws-credentials@v4
34+
if: ${{ github.secret_source == 'Actions' }}
3435
with:
3536
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
3637
aws-region: "us-east-1"
@@ -43,7 +44,7 @@ jobs:
4344
env:
4445
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
4546
- name: Log in to Docker Hub
46-
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
47+
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13' && github.secret_source == 'Actions'
4748
uses: docker/login-action@v2
4849
with:
4950
username: ${{ secrets.DOCKER_USERNAME }}

docker/nix/build_nix.sh

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ nix build .#wal-g-2 -o wal-g-2 -L
1818
nix build .#wal-g-3 -o wal-g-3 -L
1919

2020
# Copy to S3
21-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-2
22-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-3
23-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
24-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_orioledb_17
25-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_17
21+
if [[ -n "${AWS_ACCESS_KEY_ID-}" && -n "${AWS_SECRET_ACCESS_KEY-}" ]]; then
22+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-2
23+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./wal-g-3
24+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_15
25+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_orioledb_17
26+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./psql_17
27+
fi
2628

2729
if [ "$SYSTEM" = "aarch64-linux" ]; then
2830
nix build .#postgresql_15_debug -o ./postgresql_15_debug
@@ -31,10 +33,13 @@ if [ "$SYSTEM" = "aarch64-linux" ]; then
3133
nix build .#postgresql_orioledb-17_src -o ./postgresql_orioledb-17_src
3234
nix build .#postgresql_17_debug -o ./postgresql_17_debug
3335
nix build .#postgresql_17_src -o ./postgresql_17_src
34-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_debug-debug
35-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_src
36-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_debug-debug
37-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_src
38-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_debug-debug
39-
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_src
36+
37+
if [[ -n "${AWS_ACCESS_KEY_ID-}" && -n "${AWS_SECRET_ACCESS_KEY-}" ]]; then
38+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_debug-debug
39+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_15_src
40+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_debug-debug
41+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_orioledb-17_src
42+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_debug-debug
43+
nix copy --to s3://nix-postgres-artifacts?secret-key=nix-secret-key ./postgresql_17_src
44+
fi
4045
fi

0 commit comments

Comments
 (0)