From 50959094184f76e7ff3f024aa4527f605f79b894 Mon Sep 17 00:00:00 2001 From: Dima Vyshniakov Date: Mon, 1 Jan 2024 17:55:44 +0100 Subject: [PATCH 1/2] improve actions --- .github/workflows/merge-jobs.yml | 32 ++++++++++++++++++++----- .github/workflows/pull-request-jobs.yml | 31 +++++++++++++++++++----- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/.github/workflows/merge-jobs.yml b/.github/workflows/merge-jobs.yml index c268c5f..7886ba3 100644 --- a/.github/workflows/merge-jobs.yml +++ b/.github/workflows/merge-jobs.yml @@ -13,25 +13,45 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 + - name: Checkout + uses: actions/checkout@v3 + - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.10.1 + uses: styfle/cancel-workflow-action@0.12.0 with: access_token: ${{ github.token }} + - name: Read .nvmrc run: echo ::set-output name=NVMRC::$(cat .nvmrc) id: nvm + - name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} uses: actions/setup-node@v3 with: node-version: ${{ steps.nvm.outputs.NVMRC }} - cache: 'pnpm' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Run merge tasks run: | pnpm install + # - name: Publish NPM package # uses: JS-DevTools/npm-publish@v3 # with: diff --git a/.github/workflows/pull-request-jobs.yml b/.github/workflows/pull-request-jobs.yml index 02f1add..5a3286e 100644 --- a/.github/workflows/pull-request-jobs.yml +++ b/.github/workflows/pull-request-jobs.yml @@ -15,22 +15,41 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 + - name: Checkout + uses: actions/checkout@v3 + - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.10.1 + uses: styfle/cancel-workflow-action@0.12.0 with: access_token: ${{ github.token }} + - name: Read .nvmrc run: echo ::set-output name=NVMRC::$(cat .nvmrc) id: nvm + - name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} uses: actions/setup-node@v3 with: node-version: ${{ steps.nvm.outputs.NVMRC }} - cache: 'pnpm' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Run test tasks run: | pnpm install From 5f694a052b4e86360a84a61d265d5878e927bdc1 Mon Sep 17 00:00:00 2001 From: Dima Vyshniakov Date: Mon, 1 Jan 2024 17:58:57 +0100 Subject: [PATCH 2/2] update actions --- .github/workflows/pages.yml | 34 +++++++++++++++++++++---- .github/workflows/pull-request-jobs.yml | 4 +-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d41492c..766d28d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,28 +30,52 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Install pnpm - uses: pnpm/action-setup@v2 + + - name: Cancel Workflow Action + uses: styfle/cancel-workflow-action@0.12.0 with: - version: 8 + access_token: ${{ github.token }} + - name: Read .nvmrc run: echo ::set-output name=NVMRC::$(cat .nvmrc) id: nvm + - name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} uses: actions/setup-node@v3 with: node-version: ${{ steps.nvm.outputs.NVMRC }} - cache: 'pnpm' - - name: Run deploy tasks + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Build docs run: | pnpm install pnpm run build:docs --quiet + - name: Setup Pages uses: actions/configure-pages@v2 + - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: path: './storybook-static' + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v1 diff --git a/.github/workflows/pull-request-jobs.yml b/.github/workflows/pull-request-jobs.yml index 5a3286e..26e82bd 100644 --- a/.github/workflows/pull-request-jobs.yml +++ b/.github/workflows/pull-request-jobs.yml @@ -4,8 +4,6 @@ name: Node.js CI on: - # push: - # branches: [ master ] pull_request: branches: [ master ] @@ -49,7 +47,7 @@ jobs: key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - + - name: Run test tasks run: | pnpm install