From e2ae67492276c5d0a9fbd403f7ad01c9b7319b1f Mon Sep 17 00:00:00 2001 From: Sander Date: Sat, 25 Nov 2023 15:07:40 +0000 Subject: [PATCH] Pin releases on cachix Can be triggered manually or via another workflow, i.e. after the build succeeds. --- .github/workflows/buildtest.yml | 8 +++++-- .github/workflows/pin.yml | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pin.yml diff --git a/.github/workflows/buildtest.yml b/.github/workflows/buildtest.yml index c94b83a4f..ccc192991 100644 --- a/.github/workflows/buildtest.yml +++ b/.github/workflows/buildtest.yml @@ -26,13 +26,17 @@ jobs: name: devenv authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: | - nix profile remove '.*' - nix profile install --accept-flake-config . + nix profile remove '.*' + nix profile install --accept-flake-config . - name: Run tests run: | devenv ci devenv shell devenv-run-tests devenv search ncdu | grep "pkgs\.ncdu" + - name: Pin release + if: startsWith(github.ref, "refs/tags/v") + uses: ./.github/workflows/pin.yml + secrets: inherit generate-examples: runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/pin.yml b/.github/workflows/pin.yml new file mode 100644 index 000000000..a4752901f --- /dev/null +++ b/.github/workflows/pin.yml @@ -0,0 +1,39 @@ +name: "Pin release on Cachix" + +on: + workflow_dispatch: + inputs: + tag: + description: "The existing tag to build and pin" + type: "string" + required: true + + workflow_call: + secrets: + GITHUB_TOKEN: + required: false + CACHIX_AUTH_TOKEN: + required: true + +jobs: + pin: + if: startsWith(github.ref, "refs/tags/v") + + matrix: + os: [[ubuntu-latest], [macos-latest], [self-hosted, macOS], [nscloud-arm64]] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v23 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@v12 + with: + name: devenv + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - name: Pin release + run: cachix pin devenv ${{ github.ref_name }} $(nix build --accept-flake-config --print-out-paths)