Skip to content

Commit

Permalink
ci: update node setup
Browse files Browse the repository at this point in the history
  • Loading branch information
trezy committed Jul 31, 2024
1 parent 28a8d80 commit db12ea6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
26 changes: 17 additions & 9 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
name: "Install Project"
name: "Setup the project"
description: "Installs node, npm, and dependencies"

runs:
using: "composite"
steps:
- name: Use Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"

- name: Cache Dependencies
id: node-modules-cache
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-node-
- name: Install Dependencies
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
shell: bash
run: npm ci
run: npm ci --ignore-scripts --no-audit --no-fund

- name: Rebuild binaries
run: npm rebuild
16 changes: 5 additions & 11 deletions .github/workflows/handle-release-branch-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
verify:
name: CI
name: Verify
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,20 +22,14 @@ jobs:
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4

- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-fund

- name: Rebuild binaries
run: npm rebuild
- name: Setup
uses: ./.github/actions/setup

- name: ${{ matrix.script.name }}
run: npm run ${{ matrix.script.command }}

publish:
name: Publish release
name: Publish
needs:
- verify
if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref)
Expand All @@ -46,7 +40,7 @@ jobs:
with:
fetch-depth: 0

- name: Publish Release
- name: Publish release
uses: ./.github/actions/publish-release
with:
branchName: ${{ github.head_ref || github.ref_name }}
Expand Down

0 comments on commit db12ea6

Please sign in to comment.