Skip to content

Commit

Permalink
ci: use pnpm in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck committed Jun 27, 2024
1 parent b4f4fb1 commit 50f0b8b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
35 changes: 17 additions & 18 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
name: Build and Deploy

on:
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'docs/**'
- 'yarn.lock'
- 'pnpm-lock.yaml'
# trigger deployment manually
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout ⛓️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: pnpm

- name: Cache dependencies
uses: actions/cache@v3
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
# choose pnpm version to use
version: 8
# install deps with pnpm
run_install: true

- name: Build VuePress site
run: yarn docs:build
run: pnpm run docs:build

# @see https://github.com/crazy-max/ghaction-github-pages
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: docs/.vuepress/dist
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/build-only.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
name: Build Only

on:
push:
branches:
- dev
paths:
- '.github/workflows/**'
- 'docs/**'
- 'yarn.lock'
- 'pnpm-lock.yaml'
# trigger deployment manually
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout ⛓️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: pnpm

- name: Cache dependencies
uses: actions/cache@v3
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
# choose pnpm version to use
version: 8
# install deps with pnpm
run_install: true

- name: Build VuePress site
run: yarn docs:build
run: pnpm run docs:build

0 comments on commit 50f0b8b

Please sign in to comment.