Build Wittano nix repository #491
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 Wittano nix repository | |
run-name: Build Wittano nix repository | |
on: | |
repository_dispatch: | |
types: [create-pull-request] | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
types: [opened, edited, reopened, synchronize] | |
permissions: | |
contents: read | |
jobs: | |
check-flake: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v11 | |
- uses: DeterminateSystems/magic-nix-cache-action@v6 | |
- uses: DeterminateSystems/flake-checker-action@v7 | |
- name: Check nix repository | |
run: nix flake check | |
build: | |
needs: | |
- check-flake | |
strategy: | |
matrix: | |
packages: [ | |
nixos-blur-playmouth, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 10 | |
- uses: DeterminateSystems/nix-installer-action@v11 | |
- uses: DeterminateSystems/magic-nix-cache-action@v6 | |
- name: Check flake lock diff | |
id: flake-diff | |
env: | |
pkgName: ${{ matrix.packages }} | |
run: | | |
PKG_DIR=$(find ./pkgs -type d -iname $pkgName) | |
if [ -n "$PKG_DIR" ]; then | |
FILE_DIFF=$(git diff HEAD~1 -- $PKG_DIR) | |
else | |
FILE_DIFF="" | |
fi | |
DIFF=$(git diff HEAD~1 -- flake.lock) | |
if [ -n "$DIFF" ] || [ -n "$FILE_DIFF" ]; then | |
echo "raw-diff=1" >> $GITHUB_OUTPUT | |
fi | |
- name: "Install Cachix" | |
uses: cachix/cachix-action@v14 | |
if: ${{ github.ref == 'refs/heads/main' && steps.flake-diff.outputs.raw-diff }} | |
with: | |
name: wittano-nix-repo | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: "Build packages" | |
if: ${{ steps.flake-diff.outputs.raw-diff }} | |
run: "nix build .#packages.x86_64-linux.${{ matrix.packages }}" |