From 6cdafc3298d8e9ced65479f221e491cf8fee1954 Mon Sep 17 00:00:00 2001 From: Guz013 <43732358+Guz013@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:33:41 -0300 Subject: [PATCH] fix: convert workflow to an composite action --- .github/actions/pnpm-setup/action.yml | 52 +++++++++++++++++++++++++ .github/workflows/pnpm-setup.yml | 55 --------------------------- 2 files changed, 52 insertions(+), 55 deletions(-) create mode 100644 .github/actions/pnpm-setup/action.yml delete mode 100644 .github/workflows/pnpm-setup.yml diff --git a/.github/actions/pnpm-setup/action.yml b/.github/actions/pnpm-setup/action.yml new file mode 100644 index 0000000..0ce6192 --- /dev/null +++ b/.github/actions/pnpm-setup/action.yml @@ -0,0 +1,52 @@ +name: "PNPM Setup" + +inputs: + node-version: + required: false + type: number + default: 18 + pnpm-version: + required: false + type: number + default: 8 + install-deps: + required: false + type: boolean + default: true + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.node-version }} + + - name: Install PNPM + uses: pnpm/action-setup@v2 + id: pnpm-install + with: + version: ${{ inputs.pnpm-version }} + run_install: false + + - name: Get store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + if: inputs.install-deps + run: pnpm install + shell: bash \ No newline at end of file diff --git a/.github/workflows/pnpm-setup.yml b/.github/workflows/pnpm-setup.yml deleted file mode 100644 index aac4cd8..0000000 --- a/.github/workflows/pnpm-setup.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: "PNPM Setup" - -on: - workflow_call: - inputs: - node-version: - required: false - type: number - default: 18 - pnpm-version: - required: false - type: number - default: 8 - install-deps: - required: false - type: boolean - default: true - -jobs: - cache-and-install: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.node-version }} - - - name: Install PNPM - uses: pnpm/action-setup@v2 - id: pnpm-install - with: - version: ${{ inputs.pnpm-version }} - run_install: false - - - name: Get store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - if: inputs.install-deps - run: pnpm install \ No newline at end of file