diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml new file mode 100644 index 0000000..766b202 --- /dev/null +++ b/.github/actions/prepare/action.yml @@ -0,0 +1,28 @@ +name: Prepare +description: Install dependencies and build +inputs: + build: + description: Build + required: false + default: 'true' + +runs: + using: composite + steps: + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'pnpm' + + - name: Install dependencies + shell: bash + run: pnpm install --frozen-lockfile + + - name: Build + if: inputs.build == 'true' + shell: bash + run: pnpm build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 483a451..9fad962 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,17 +8,5 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build + - name: Prepare and Build + uses: ./.github/actions/prepare diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 0984a6c..b397fa4 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -28,17 +28,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Prepare + uses: ./.github/actions/prepare with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile + build: false - name: Install ESLint SARIF run: pnpm install @microsoft/eslint-formatter-sarif diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4121bc..12db891 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build + - name: Prepare and Build + uses: ./.github/actions/prepare - name: Create Release Pull Request or Publish to npm id: changesets diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cce9fa3..9e0e17f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,20 +14,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build + - name: Prepare and Build + uses: ./.github/actions/prepare - name: Start services using Docker Compose run: docker compose -f docker-compose.test.yml up -d