Upgrade storybook (#1872) #1204
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: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v3 | |
name: Check for build cache | |
id: build-cache | |
with: | |
path: | | |
**/dist | |
!**/node_modules | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }} | |
# Only setup & build if there was no build cache hit | |
- name: Use Node 16 | |
uses: actions/setup-node@v3 | |
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }} | |
with: | |
node-version: '16' | |
cache: yarn | |
cache-dependency-path: 'yarn.lock' | |
- name: Install | |
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }} | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: build | |
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }} | |
run: yarn build | |
chromatic: | |
name: Establish Chromatic baseline | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: yarn | |
cache-dependency-path: 'yarn.lock' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- uses: actions/cache/restore@v3 | |
name: Restore build cache | |
id: build-cache | |
with: | |
path: | | |
**/dist | |
!**/node_modules | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }} | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
with: | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
buildScriptName: 'build-storybook' | |
exitOnceUploaded: true | |
exitZeroOnChanges: true | |
autoAcceptChanges: true | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: yarn | |
cache-dependency-path: 'yarn.lock' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- uses: actions/cache/restore@v3 | |
name: Restore build cache | |
id: build-cache | |
with: | |
path: | | |
**/dist | |
!**/node_modules | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }} | |
- name: Version packages | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: yarn changeset version | |
publish: yarn run publish | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' | |
notify: | |
name: Notify Slack & Website | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Dispatch to Website repo | |
if: ${{ needs.release.outputs.published == 'true' }} | |
uses: peter-evans/repository-dispatch@v2 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.DESIGN_REPO_ACCESS_TOKEN }} | |
repository: mongodb/design | |
event-type: release-leafygreen-ui | |
- name: Notify Slack channel of new releases | |
if: ${{ needs.release.outputs.published == 'true' }} | |
id: slackbot | |
run: yarn slackbot '${{ needs.release.outputs.publishedPackages }}' | |
env: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' |