Skip to content

Merge pull request #17 from cachix/update_flake_lock_action #110

Merge pull request #17 from cachix/update_flake_lock_action

Merge pull request #17 from cachix/update_flake_lock_action #110

Workflow file for this run

name: Build & Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CACHE_NAME: cachix-ci-agents
jobs:
build:
strategy:
matrix:
os: [[ubuntu-latest], [self-hosted, macOS, ARM64], [self-hosted, Linux, ARM64]]
runs-on: ${{ matrix.os }}
outputs:
x86_64-linux: ${{ steps.agent.outputs.x86_64-linux }}
aarch64-darwin: ${{ steps.agent.outputs.aarch64-darwin }}
aarch64-linux: ${{ steps.agent.outputs.aarch64-linux }}
steps:
- run: sudo rm -rf /opt&
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- uses: cachix/cachix-action@v14
with:
name: ${{ env.CACHE_NAME }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build
run: nix -L flake check
- run: echo "$(nix eval --raw --impure --expr 'builtins.currentSystem')=$(nix build --print-out-paths)" >> $GITHUB_OUTPUT
id: agent
deploy:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- uses: cachix/cachix-action@v14
with:
name: ${{ env.CACHE_NAME }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Deploy
env:
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }}
run: |
cat << EOF >> deploy.json
{
"agents": {
"linux": "${{ needs.build.outputs.x86_64-linux }}",
"macos": "${{ needs.build.outputs.aarch64-darwin }}",
"aarch64-linux": "${{ needs.build.outputs.aarch64-linux }}"
}
}
EOF
cachix deploy activate deploy.json