From bb89b7e5f5577e9936d87b55e148376613c7a002 Mon Sep 17 00:00:00 2001 From: Jamie Brynes Date: Sat, 31 Aug 2024 15:45:25 +0100 Subject: [PATCH] ci: refactor out common build steps in CI pipelines --- .github/actions/setup/action.yml | 13 +++++++++++++ .github/workflows/docs.yml | 12 ++---------- .github/workflows/premerge.yml | 24 ++++-------------------- .github/workflows/release.yml | 12 ++---------- 4 files changed, 21 insertions(+), 40 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..2264370 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,13 @@ +name: "Common Setup" +description: "Sets up Nix and the development environment" +runs: + using: "composite" + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Setup Magic Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + - name: Use nix-develop shell + uses: nicknovitski/nix-develop@v1.1.0 + with: + arguments: ./nix --impure diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c419ba7..8d62cb5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,16 +26,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - - - name: Setup Magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Use nix-develop shell - uses: nicknovitski/nix-develop@v1.1.0 - with: - arguments: ./nix --impure + - name: Setup + uses: ./.github/actions/setup - name: Install dependencies run: npm install diff --git a/.github/workflows/premerge.yml b/.github/workflows/premerge.yml index 0b30760..e21cb1a 100644 --- a/.github/workflows/premerge.yml +++ b/.github/workflows/premerge.yml @@ -8,16 +8,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - - - name: Setup Magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Use nix-develop shell - uses: nicknovitski/nix-develop@v1.1.0 - with: - arguments: ./nix --impure + - name: Setup + uses: ./.github/actions/setup - name: Install dependencies run: npm install @@ -44,16 +36,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - - - name: Setup Magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Use nix-develop shell - uses: nicknovitski/nix-develop@v1.1.0 - with: - arguments: ./nix --impure + - name: Setup + uses: ./.github/actions/setup - name: Install dependencies run: npm install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43866de..a02dcc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,16 +11,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - - - name: Setup Magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Use nix-develop shell - uses: nicknovitski/nix-develop@v1.1.0 - with: - arguments: ./nix --impure + - name: Setup + uses: ./.github/actions/setup - name: Install dependencies run: npm install