diff --git a/.github/actions/install-npm-deps/action.yml b/.github/actions/install-npm-deps/action.yml new file mode 100644 index 0000000..01e78c6 --- /dev/null +++ b/.github/actions/install-npm-deps/action.yml @@ -0,0 +1,17 @@ +name: Setup node_modules +description: Restores or reinstall the node_modules cache + +runs: + using: "composite" + steps: + - name: Trying to pull node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-${{ github.repository }}-node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies if cache is not found + if: steps.cache-node-modules.outputs.cache-hit != 'true' + shell: bash + run: npm ci --ignore-scripts diff --git a/.github/actions/pull-npm-deps/action.yml b/.github/actions/pull-npm-deps/action.yml new file mode 100644 index 0000000..ea736e5 --- /dev/null +++ b/.github/actions/pull-npm-deps/action.yml @@ -0,0 +1,11 @@ +name: Pull node_modules +description: Pulls the node_modules cache + +runs: + using: "composite" + steps: + - name: Pull node_modules + uses: actions/cache/restore@v4 + with: + path: node_modules + key: ${{ runner.os }}-${{ github.repository }}-node-modules-${{ hashFiles('package-lock.json') }} diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 0000000..1281df9 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,15 @@ +name: Setup Node.js +runs: + using: "composite" + steps: + - name: Read Node.js version from .nvmrc + id: read-version + run: | + NODE_VERSION=$(cat .nvmrc | sed 's/^v//') + echo "node-version=$NODE_VERSION" >> $GITHUB_ENV + shell: bash + + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.node-version }} diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml new file mode 100644 index 0000000..bb33806 --- /dev/null +++ b/.github/workflows/build-check.yml @@ -0,0 +1,13 @@ +name: Build check + +on: + push: + +jobs: + install-deps: + name: Install dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-node + - uses: ./.github/actions/install-npm-deps \ No newline at end of file