1305 react + css file component #2938
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: Build and deploy Storybook | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up Node.js version | |
uses: actions/setup-node@v3.2.0 | |
with: | |
node-version: "16.13.x" | |
- name: yarn install | |
run: | | |
npm install -g yarn | |
yarn install --frozen-lockfile | |
- name: run linters | |
run: | | |
yarn lint:css | |
yarn lint:package | |
yarn lint:js | |
yarn lint:prettier | |
- name: build library | |
run: yarn build:library | |
- name: typecheck storybook | |
run: yarn typecheck:storybook | |
- name: build storybook | |
run: yarn build:storybook | |
- name: Upload storybook | |
uses: actions/upload-artifact@v3 | |
with: | |
name: storybook | |
path: storybook-static | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
if: github.event.pull_request.draft == false | |
with: | |
autoAcceptChanges: main | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
storybookBuildDir: storybook-static | |
deploy-storybook: | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download storybook artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: storybook | |
path: storybook-static | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4.3.4 | |
with: | |
branch: gh-pages | |
folder: storybook-static | |
publish-npm: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_ADMIN_TOKEN }} | |
- name: Set up Node.js version | |
uses: actions/setup-node@v3.2.0 | |
with: | |
node-version: "16.13.x" | |
- name: yarn install | |
run: | | |
npm install -g yarn | |
yarn install --frozen-lockfile | |
- name: build library | |
run: yarn build | |
- name: lerna version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_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 | |
yarn release -- --yes | |
- name: lerna publish | |
env: | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
npm config set "//registry.npmjs.org/:_authToken" "${NPM_ACCESS_TOKEN}" | |
npm config set access public | |
npm run publish -- --no-verify-access --yes | |
npm config delete "//registry.npmjs.org/:_authToken" |