From 988f73d2112d24ac22a5da0c12eb3be75a2aae0b Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Sun, 27 Aug 2023 22:01:30 -0500 Subject: [PATCH] Common install package action --- .github/actions/install-packages/action.yml | 26 +++++++++++++++++++++ .github/workflows/npm-cache-packages.yml | 6 ++--- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/actions/install-packages/action.yml diff --git a/.github/actions/install-packages/action.yml b/.github/actions/install-packages/action.yml new file mode 100644 index 000000000..4aa31787d --- /dev/null +++ b/.github/actions/install-packages/action.yml @@ -0,0 +1,26 @@ +name: 'Install packages' +description: "Install packages" +inputs: + node: + description: "Which node version?" + ruby: + description: "Which ruby version?" +runs: + using: "composite" + steps: + + - uses: actions/setup-node@v3 + if: ${{ inputs.node != '' }} + with: + node-version: ${{ inputs.node }} + cache: 'yarn' + + - run: yarn install --frozen-lockfile + if: ${{ inputs.node != '' }} + shell: sh + + - uses: ruby/setup-ruby@v1 + if: ${{ inputs.ruby != '' }} + with: + ruby-version: ${{ inputs.ruby }} + bundler-cache: true diff --git a/.github/workflows/npm-cache-packages.yml b/.github/workflows/npm-cache-packages.yml index e54969e26..33cf8f27e 100644 --- a/.github/workflows/npm-cache-packages.yml +++ b/.github/workflows/npm-cache-packages.yml @@ -14,8 +14,6 @@ jobs: runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: ./.github/actions/install-packages with: - node-version: ${{ inputs.node }} - cache: 'yarn' - - run: yarn install --frozen-lockfile + node: ${{ inputs.node }}