Skip to content

Commit

Permalink
ci: update gh actions pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
AykutSarac committed Dec 24, 2023
1 parent bbea0de commit d33aa57
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 37 deletions.
50 changes: 29 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,36 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Detect package manager
id: detect-package-manager
run: |
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
exit 0
- name: Setup Node

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Cache node_modules
uses: actions/cache@v3
node-version: "20"

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
path: |
~/.npm
~/.cache/pnpm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Pages
uses: actions/configure-pages@v3
with:
static_site_generator: next

- name: Restore cache
uses: actions/cache@v3
with:
Expand All @@ -57,15 +61,19 @@ jobs:
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
run: pnpm install

- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
run: pnpm next build

- name: Upload Build Artifacts
uses: actions/upload-artifact@v2
with:
name: build-files
path: ./out/_next/static/chunks

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
54 changes: 38 additions & 16 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,44 @@ on:
branches: [ "main" ]

jobs:
build:
cache-and-install:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm lint
- run: pnpm build
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm run lint

- name: Build
run: pnpm run build


0 comments on commit d33aa57

Please sign in to comment.