diff --git a/.github/actions/restore-node/action.yml b/.github/actions/restore-node/action.yml new file mode 100644 index 0000000..cdf6c24 --- /dev/null +++ b/.github/actions/restore-node/action.yml @@ -0,0 +1,22 @@ +name: Restore Node.js env + +description: Restore the task runner infrastructure by Node.js + +runs: + using: 'composite' + steps: + - name: Setup node.js + uses: actions/setup-node@v4 + with: + node-version-file: ./.node-version + + - name: cache node_modules + uses: actions/cache@v4 + with: + path: | + ./node_modules + key: node-${{ hashFiles('package-lock.json') }} + + - name: install node_modules + shell: bash + run: npm install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index abf4751..721a3a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,13 +30,8 @@ jobs: fetch-depth: 0 persist-credentials: false - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version-file: ./.node-version - - - name: Install Dependencies - run: npm install + - name: Initialize + uses: ./.github/actions/restore-node - name: Release run: npm run release ${{ github.event.inputs.dry_run == 'true' && '-- --dry-run' || '' }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 133ebb2..7585179 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,21 +7,15 @@ on: jobs: test: - strategy: - matrix: - eslint: [8] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: ./.node-version + - name: Initialize + uses: ./.github/actions/restore-node - - name: Use ESLint ${{ matrix.eslint }} - run: npm install eslint@${{ matrix.eslint }} + - name: Run Lint + run: npm run lint - - run: | - npm install --silent - npm run lint - npm run test + - name: Run Test + run: npm run test