From 79dce0618068a96b678531d069099fae1ebc8165 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Wed, 11 Sep 2024 01:19:46 +0200 Subject: [PATCH] ci: conditional jobs --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fad5ce4..5921407 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,35 @@ on: - main jobs: + changes: + runs-on: ubuntu-latest + outputs: + src: ${{ steps.changes.outputs.src }} + infra: ${{ steps.changes.outputs.infra }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + nixos-configuration: + - flake.nix + - flake.lock + - 'configurations/nixos/**' + - 'modules/nixos/**' + - 'modules/home/**' + home-configuration: + - flake.nix + - flake.lock + - 'configurations/home/**' + - 'modules/home/**' + installer-yubikey: + - flake.nix + - flake.lock + - 'configurations/nixos/installer-yubikey/**' + - 'packages/drduh-gpg-conf/**' + - 'packages/drduh-yubikey-guide/**' + check: runs-on: ubuntu-latest steps: @@ -33,6 +62,8 @@ jobs: run: nix flake check build-home-configuration: + needs: changes + if: ${{ needs.changes.outputs.home-configuration == 'true' }} strategy: matrix: include: @@ -61,6 +92,8 @@ jobs: nix build --print-build-logs .#homeConfigurations.${{ matrix.username }}.activationPackage build-nixos-configuration: + needs: changes + if: ${{ needs.changes.outputs.nixos-configuration == 'true' }} strategy: matrix: host: @@ -89,6 +122,8 @@ jobs: nix build --print-build-logs .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel build-iso: + needs: changes + if: ${{ needs.changes.outputs.installer-yubikey == 'true' }} strategy: matrix: name: