deps: update #131
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
id: agent | |
run: | | |
system=$(nix eval --raw --impure --expr 'builtins.currentSystem') | |
echo "Building machine for $system" | |
out_path=$(nix build -L --print-out-paths --accept-flake-config) | |
echo "Built $out_path" | |
echo "$system=$out_path" >> $GITHUB_OUTPUT | |
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 |