From b25a05545c074f3990e057ad3aa3df80c44c9dd4 Mon Sep 17 00:00:00 2001 From: Asa <26807394+a01sa01to@users.noreply.github.com> Date: Mon, 3 Jul 2023 01:43:18 +0000 Subject: [PATCH] refactor(ci): #4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - checkout処理の重複を削除 - Cacheをsetup-nodeにお任せ - matrixを定義 --- .github/workflows/format.yml | 38 ++++++++++-------------------------- .github/workflows/lint.yml | 37 ++++++++++------------------------- 2 files changed, 20 insertions(+), 55 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index b1cff93..d45e8bf 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -5,49 +5,31 @@ on: pull_request jobs: lint: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8.6.2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: 18 + node-version: ${{ matrix.node-version }} + cache: pnpm registry-url: 'https://npm.pkg.github.com' scope: '@saitamau-maximum' always-auth: true env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - - uses: pnpm/action-setup@v2.2.4 - with: - version: 8.6.2 - - - name: Expose pnpm config(s) through "$GITHUB_OUTPUT" - id: pnpm-config - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Cache rotation keys - id: cache-rotation - shell: bash - run: | - echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-config.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}- - - name: Install dependencies - shell: bash run: pnpm install --frozen-lockfile --prefer-offline - name: format diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0d82b07..ae3b27a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,47 +5,30 @@ on: pull_request jobs: lint: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8.6.2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: 18 + node-version: ${{ matrix.node-version }} + cache: pnpm registry-url: 'https://npm.pkg.github.com' scope: '@saitamau-maximum' always-auth: true env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - - uses: pnpm/action-setup@v2.2.4 - with: - version: 8.6.2 - - - name: Expose pnpm config(s) through "$GITHUB_OUTPUT" - id: pnpm-config - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Cache rotation keys - id: cache-rotation - shell: bash - run: | - echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-config.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}- - - name: Install dependencies shell: bash run: pnpm install --frozen-lockfile --prefer-offline