install pnpm only first time or on version mismatch

This commit is contained in:
starbirdtech383
2023-09-27 23:51:53 +05:30
committed by starbirdtech383
parent 492d57efd0
commit 74ecc45864
4 changed files with 97 additions and 31 deletions

View File

@@ -17,32 +17,30 @@ jobs:
timeout-minutes: 100
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3
- name: Check node,pnpm Installation and set Path
shell: bash
working-directory: scripts/self-hosted-gh-runner
timeout-minutes: 1
run: |
./node-pnpm-check.sh
echo "make sure below mentioned versions are expected versions"
echo "If you are expecting the node and pnpm versions to be updated. Please update the node-pnpm-check.sh script"
env
- name: Setup Node
if: ${{ env.SETUP_NODE != 'false' }}
uses: actions/setup-node@v3
with:
node-version: 18.14.0
node-version: ${{ env.NC_REQ_NODE_V }}
- name: Setup pnpm
if: ${{ env.SETUP_PNPM != 'false' }}
uses: pnpm/action-setup@v2
with:
version: 8
version: ${{ env.NC_REQ_PNPM_V }}
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=/root/setup-pnpm/node_modules/.bin/store/v3" >> $GITHUB_ENV
- name: check if npm cache is needed
shell: bash
run: |
IS_NPM_CACHE_DOWNLOAD_REQUIRED="/cache-marker-v1.txt"
# update the above file name to force the cache ex: /cache-marker-v2.txt.
if [[ ! -f ${PRE_REQ_CHECK_FILE_PATH} ]];
then
echo "IS_NPM_CACHE_DOWNLOAD_REQUIRED is true"
IS_NPM_CACHE_DOWNLOAD_REQUIRED="true"
else
IS_NPM_CACHE_DOWNLOAD_REQUIRED="false"
fi
echo "IS_NPM_CACHE_DOWNLOAD_REQUIRED=${IS_NPM_CACHE_DOWNLOAD_REQUIRED}" >> $GITHUB_ENV
- uses: actions/cache@v3
if: env.IS_NPM_CACHE_DOWNLOAD_REQUIRED == 'true'
name: Setup pnpm cache