Skip to content

Commit

Permalink
Pin releases on cachix
Browse files Browse the repository at this point in the history
Can be triggered manually or via another workflow, i.e. after the build
succeeds.
  • Loading branch information
sandydoo committed Nov 25, 2023
1 parent 38302f4 commit e2ae674
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/pin.yml
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e2ae674

Please sign in to comment.