LG-4662: Fix CommonJS imports (#2587) #1686
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@v3 | |
# Needed following Github's transition from Node 16 to 20 | |
- name: Install node-gyp | |
run: yarn global add node-gyp | |
- uses: actions/cache@v3 | |
name: Check for build cache | |
id: build-cache | |
with: | |
path: | | |
**/dist | |
!**/node_modules | |
**/tsdoc.json | |
**/stories.js | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }} | |
# Only setup & build if there was no build cache hit | |
- name: Use Node 18 | |
uses: actions/setup-node@v3 | |
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }} | |
with: | |
node-version: '18' | |
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 | |
- name: Generate docs | |
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }} | |
run: yarn turbo run docs | |
chromatic: | |
name: Establish Chromatic baseline | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
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 | |
**/tsdoc.json | |
**/stories.js | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/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@v3 | |
- name: Use Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
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 | |
**/tsdoc.json | |
**/stories.js | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/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] | |
if: ${{ needs.release.outputs.published == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Needed following Github's transition from Node 16 to 20 | |
- name: Install node-gyp | |
run: yarn global add node-gyp | |
- name: Install | |
run: yarn install --frozen-lockfile --prefer-offline | |
- uses: actions/cache/restore@v3 | |
name: Restore build cache | |
id: build-cache | |
with: | |
path: | | |
**/dist | |
!**/node_modules | |
**/tsdoc.json | |
**/stories.js | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }} | |
- name: Notify Slack channel of new releases | |
id: slackbot | |
run: yarn slackbot '${{ needs.release.outputs.publishedPackages }}' | |
env: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
dispatch-to-website: | |
name: Dispatch to Website repo | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: ${{ needs.release.outputs.published == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dispatch to Website repo | |
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 | |
client-payload: '{ "packages": ${{ toJson(needs.release.outputs.publishedPackages) }} }' |