Skip to content

docs(release): design system packages #5100

docs(release): design system packages

docs(release): design system packages #5100

name: Continuous Delivery
on:
push:
branches:
- main
pull_request:
env:
CI: true
MAIN_BRANCH: "main"
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
pnpm ls --recursive
lint:
runs-on: ubuntu-latest
needs: install
env:
NODE_OPTIONS: "--max-old-space-size=6114"
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: "Continuous Integration: lint"
run: |
pnpm run --if-present lint
build:
runs-on: ubuntu-latest
needs: install
env:
NODE_OPTIONS: "--max-old-space-size=6114"
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: "Continuous Integration: build"
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present build
- name: "Continuous Integration: lint build"
run: |
pnpm run --if-present lint-build
- name: "Continuous Integration: test build"
run: |
pnpm run --if-present test-build
- name: "Continuous Integration: Git status"
shell: bash
run: |
if git diff --no-ext-diff --quiet --exit-code ; then
echo "No unstaged changes that would prevent 'npm publish'"
exit 0
else
echo "The following unstaged changes occur after the build step. Add the files to Git or specify the paths in '.gitignore' to proceed."
git diff --exit-code
exit 1
fi
- name: "Retain build artifact: website"
uses: actions/upload-artifact@v4
with:
name: website
path: packages/design-system-website/dist/
retention-days: 1
- name: "Retain build artifact: storybook"
uses: actions/upload-artifact@v4
with:
name: storybook
path: packages/storybook/dist/
retention-days: 1
test:
runs-on: ubuntu-latest
needs: install
env:
NODE_OPTIONS: "--max-old-space-size=6114"
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: "Continuous Integration: test"
run: |
pnpm run --if-present test
visual-regression-test:
runs-on: ubuntu-latest
needs: install
env:
NODE_OPTIONS: "--max-old-space-size=6114"
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: "Continuous Integration: build Storybook with animation disabled"
env:
STORYBOOK_REDUCED_MOTION: 1
run: |
pnpm run --if-present build
- name: Publish to Chromatic
uses: chromaui/action@v10
if: github.event.pull_request.draft == false
with:
autoAcceptChanges: ${{ env.MAIN_BRANCH }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: packages/storybook-css/dist/
publish-website:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout release branch
uses: actions/checkout@v4
- name: "Restore build artifact: website"
uses: actions/download-artifact@v4
with:
name: website
path: packages/design-system-website/dist/
- name: Continuous Deployment to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: packages/design-system-website/dist/
- name: Continuous Deployment to designsystem.utrecht.nl
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: ${{ env.MAIN_BRANCH }}
folder: packages/design-system-website/dist/
repository-name: nl-design-system/designsystem.utrecht.nl
token: ${{ secrets.DOCS_GH_TOKEN }}
publish-npm:
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/main'
env:
NODE_OPTIONS: "--max-old-space-size=6114"
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8.3
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: "Continuous Deployment: install"
run: |
pnpm install --frozen-lockfile
pnpm ls --recursive
- name: "Continuous Deployment: build"
run: |
pnpm run --if-present build
- name: "Continuous Deployment: 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"
MAIN_BRANCH:
run: |
git push --set-upstream origin HEAD
pnpm run release
- name: "Continuous Deployment: publish changeset to GitHub repository"
uses: changesets/action@v1
id: changeset
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"
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
commit: "docs(release): design system packages [skip ci]"
setupGitUser: false
title: "docs(release): design system packages"
publish: "pnpm run publish:changeset"
- name: "Continuous Deployment: publish to npm"
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"