feat: implemented changesets functionality (#1302) #2793
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 Delivery | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
lint: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- 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 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: "Continuous Integration: build" | |
env: | |
BASE_URL: "/utrecht/" | |
run: pnpm run --if-present build | |
- name: "Retain build artifact: Storybook" | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
retention-days: 1 | |
- name: "Retain build artifact: CSS" | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: css | |
path: packages/components-css/dist/ | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: "Restore build artifact: Storybook" | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
- name: "Restore build artifact: CSS" | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: css | |
path: packages/components-css/dist/ | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: "Continuous Integration: test" | |
run: pnpm run --if-present test | |
- name: Publish to Chromatic | |
uses: chromaui/action@2929680e80a2298d17561b7f1deaa334653f905e # 11.16.5 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
with: | |
autoAcceptChanges: main | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
storybookBuildDir: packages/storybook/dist/ | |
publish-website: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout release branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: "Restore build artifact: Storybook" | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
- name: Continuous Deployment to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@15de0f09300eea763baee31dff6c6184995c5f6a # v4.7.2 | |
with: | |
branch: gh-pages | |
folder: packages/storybook/dist/ | |
token: ${{ secrets.GH_TOKEN }} | |
test-a11y: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: "Restore build artifact: Storybook" | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: storybook | |
path: packages/storybook/dist/ | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: "Accessibility tests Storybook" | |
run: pnpm test-storybook:ci | |
check-changeset: | |
runs-on: ubuntu-latest | |
needs: install | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm package manager | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Check for missing changeset | |
run: pnpm changeset status --since=origin/main | |
publish-npm: | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout release branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set up Node.js version | |
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
- name: "Continuous Deployment: install" | |
run: pnpm install --frozen-lockfile | |
- name: "Continuous Deployment: build" | |
run: pnpm run --if-present build | |
- name: "Continuous Deployment: update versions and publish to NPM" | |
uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 | |
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" | |
setupGitUser: false | |
title: "docs(release): design system packages" | |
publish: "pnpm run publish:changeset" |