diff --git a/README.md b/README.md index b471993..103f3b3 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@v16 + uses: cachix/install-nix-action@v23 - name: Set up cache - uses: zombiezen/setup-nix-cache-action@v0.1.0 + uses: zombiezen/setup-nix-cache-action@v0.3.0 with: substituters: s3://example-bucket secret_keys: ${{ secrets.NIX_PRIVATE_KEY }} @@ -33,8 +33,7 @@ jobs: run: nix-build ``` -Using a [Google Cloud Storage][] bucket for loading and storing -with the [interoperability endpoint][]: +Using a [Google Cloud Storage][] bucket for loading and storing: ```yaml name: Build @@ -44,11 +43,43 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@v16 + uses: cachix/install-nix-action@v23 + - name: Authenticate to Google Cloud Platform + # See https://github.com/google-github-actions/auth/blob/main/README.md + # for details on how to set up. + uses: google-github-actions/auth@v1 - name: Set up cache - uses: zombiezen/setup-nix-cache-action@v0.1.0 + uses: zombiezen/setup-nix-cache-action@v0.3.0 + with: + substituters: gs://example-bucket + secret_keys: ${{ secrets.NIX_PRIVATE_KEY }} + use_nixcached: true + - name: Build + run: nix-build +``` + +The example above uses [nixcached][] to connect to Google Cloud Storage +using normal service account credentials. +If you prefer to avoid the dependency, you can instead use the [interoperability endpoint][], +but you will have to generate an HMAC key: + +```yaml +# Connecting to GCS without nixcached (not recommended). + +name: Build +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v23 + - name: Set up cache + uses: zombiezen/setup-nix-cache-action@v0.3.0 with: substituters: s3://example-bucket?endpoint=https://storage.googleapis.com secret_keys: ${{ secrets.NIX_PRIVATE_KEY }} @@ -61,6 +92,7 @@ jobs: [Amazon Web Services S3]: https://aws.amazon.com/s3/ [Google Cloud Storage]: https://cloud.google.com/storage [interoperability endpoint]: https://cloud.google.com/storage/docs/interoperability +[nixcached]: https://github.com/zombiezen/nixcached ## Inputs @@ -86,6 +118,11 @@ Access key ID for downloading and uploading artifacts Secret access key for downloading and uploading artifacts +### `use_nixcached` + +If `true`, use [nixcached][] for uploading and downloading. +This permits concurrent uploading and more straightforward authentication. + ## License [Apache 2.0](LICENSE)