Merge pull request #110 from cachix/renovate/lock-file-maintenance #435
This file contains hidden or 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 | |
| # PRs: cancel previous run on push. | |
| # main: run sequentially, waiting for previous run. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| env: | |
| CACHE_NAME: cachix-ci-agents | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: | |
| - [ubuntu-latest] | |
| - [ubuntu-24.04-arm] | |
| - [macos-latest] | |
| 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@v7 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: cachix/cachix-action@v17 | |
| with: | |
| name: ${{ env.CACHE_NAME }} | |
| authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
| - name: Version info | |
| run: nix --version | |
| - 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 | |
| # Wait for all paths to flush to daemon. TODO: fix upstream. | |
| sleep 3 | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| needs: build | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: cachix/install-nix-action@v31 | |
| - uses: cachix/cachix-action@v17 | |
| 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 |