Skip to content

build: add engines.pnpm to package.json #148

build: add engines.pnpm to package.json

build: add engines.pnpm to package.json #148

name: Continuous Delivery
on:
push:
branches:
- main
pull_request:
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
- name: Install pnpm package manager
uses: pnpm/action-setup@v3.0.0
with:
version: 8
- name: Set up Node.js version
uses: actions/setup-node@v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install
pnpm ls --recursive
lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
- uses: pnpm/action-setup@v3.0.0
name: Install pnpm package manager
with:
version: 8
- name: Set up Node.js version
uses: actions/setup-node@v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install
- name: Run the lint script in package.json scripts
run: |
pnpm run --if-present lint
build:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
- uses: pnpm/action-setup@v3.0.0
name: Install pnpm package manager
with:
version: 8
- name: Set up Node.js version
uses: actions/setup-node@v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install
- name: Run the build script in package.json scripts
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present build
- name: Run the lint-build script in package.json scripts
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present lint-build
- name: Run the test-build script in package.json scripts
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present test-build
- name: Upload the Storybook artifact from the build step
uses: actions/upload-artifact@v4.3.1
with:
name: storybook
path: packages/storybook/dist/
retention-days: 1
test:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
- name: Install pnpm package manager
uses: pnpm/action-setup@v3.0.0
with:
version: 8
- name: Set up Node.js version
uses: actions/setup-node@v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install
- name: Run the test script in package.json scripts
run: |
pnpm run --if-present test
publish-website:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
- name: Download the Storybook artifact from the "Build" job
uses: actions/download-artifact@v4.1.4
with:
name: storybook
path: packages/storybook/dist/
- name: Continuous Deployment to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: packages/storybook/dist/
publish-npm:
runs-on: ubuntu-latest
needs:
- lint
- test
if: github.ref == 'refs/heads/main'
steps:
- name: Download code from GitHub
uses: actions/checkout@v4.1.2
with:
token: ${{ secrets.GH_TOKEN }}
- uses: pnpm/action-setup@v3.0.0
name: Install pnpm package manager
with:
version: 8.14
- name: Set up Node.js version
uses: actions/setup-node@v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install
pnpm ls --recursive
- name: Run the build script from package.json scripts
run: |
pnpm run --if-present build
- name: Publish to GitHub repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: "NL Design System"
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: "NL Design System"
run: |
git push --set-upstream origin HEAD
pnpm run release
- name: Publish to npm repository
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
pnpm run publish
pnpm config delete "//registry.npmjs.org/:_authToken"