ci: manual nixsgx cache upload

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-06-10 16:17:50 +02:00
parent d9eb744741
commit c1955bc046
Signed by: harald
GPG key ID: F519A1143B3FBE32

37
.github/workflows/cachix.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: cachix
on:
pull_request:
branches: [ "main" ]
push:
branches: ["main"]
workflow_dispatch:
inputs:
target_branch:
description: "Target branch to upload cachix"
type: string
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- uses: cachix/cachix-action@v15
with:
name: nixsgx
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Enable magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: nix build
run: nix run github:nixos/nixpkgs/nixos-23.11#nixci
- name: manual cachix upload
run: |
a=($(nix flake show --accept-flake-config --json | jq -r ".packages.\"x86_64-linux\" | keys | @sh" | tr -d \\\' ))
nix build --accept-flake-config --json "${a[@]/#/.#}" | jq -r '.[].outputs | to_entries[].value' | cachix push nixsgx