build: use pnpm everywhere #1211
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Deployment | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
continuous-integration: | |
name: Continuous integration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download code from GitHub | |
uses: actions/[email protected] | |
- name: Install pnpm package manager | |
uses: pnpm/[email protected] | |
with: | |
version: 8.14 | |
- name: Set up Node.js version | |
uses: actions/[email protected] | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: Install dependencies specified in package.json | |
run: | | |
pnpm install | |
pnpm ls --recursive | |
- name: Run the lint script in package.json scripts | |
run: | | |
pnpm run --if-present lint | |
# - name: "Continuous Integration: public code validator" | |
# uses: nl-design-system/publiccode-parser-action@latest | |
- name: Run the build script in package.json scripts | |
run: | | |
npm run --if-present build | |
- name: Run the test script in package.json scripts | |
run: | | |
npm run --if-present test | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
if: github.event.pull_request.draft == false | |
with: | |
autoAcceptChanges: main | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
storybookBuildDir: packages/storybook/dist/ | |
- name: Upload the Storybook artifact from the build step | |
uses: actions/[email protected] | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
retention-days: 1 | |
- name: Upload the Playroom artifact from the build step | |
uses: actions/[email protected] | |
with: | |
name: playroom | |
path: packages/playroom/dist/ | |
retention-days: 1 | |
publish-storybook: | |
runs-on: ubuntu-latest | |
needs: continuous-integration | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download code from GitHub | |
uses: actions/[email protected] | |
- name: Download the Storybook artifact from the "Build" job | |
uses: actions/[email protected] | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
- name: Download the Playroom artifact from the "Build" job | |
uses: actions/[email protected] | |
with: | |
name: playroom | |
path: packages/storybook/dist | |
- name: Continuous Deployment to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: packages/storybook/dist/ | |
publish-npm: | |
runs-on: ubuntu-latest | |
needs: continuous-integration | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download code from GitHub | |
uses: actions/[email protected] | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install pnpm package manager | |
uses: pnpm/[email protected] | |
with: | |
version: 8.14 | |
- name: Set up Node.js version | |
uses: actions/[email protected] | |
with: | |
node-version-file: .nvmrc | |
- name: Install dependencies specified in package.json | |
run: | | |
pnpm install | |
pnpm ls --recursive | |
- name: Run the build script in package.json | |
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" |