From deb91d4eb3902b9b54804ff75039bc83fd31757a Mon Sep 17 00:00:00 2001 From: Florian Sanders Date: Tue, 26 Mar 2024 12:44:57 +0100 Subject: [PATCH] test gh action with nix --- .github/workflows/test.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15a61d6..0c1185e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,17 +2,23 @@ name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: - Explore-GitHub-Actions: + Prefetch-npm-deps: runs-on: ubuntu-latest + outputs: + NPM_DEPS_HASH: ${{ steps.prefetch.outputs.NPM_DEPS_HASH }} steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." + - uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v26 + with: + github_access_token: ${{ secrets.PERSO_TOKEN }} + nix_path: nixpkgs=channel:nixos-unstable + - name: Install prefetch-npm-deps + run: nix-env -i prefetch-npm-deps -f '' + - name: prefetch + id: prefetch + run: echo "NPM_DEPS_HASH=$(prefetch-npm-deps package-lock.json)" >> $GITHUB_OUTPUT + - name: update + run: sed -i 's/sha[^"]\+/'"${{ steps.prefetch.outputs.NPM_DEPS_HASH }}"'/' flake.nix + - run: cat flake.nix +