Skip to content

Commit

Permalink
Updates Release CI (#1863)
Browse files Browse the repository at this point in the history
* Updates Release CI

* rename jobs
  • Loading branch information
TheSonOfThomp authored Jul 25, 2023
1 parent 215268f commit 4db5fb5
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 31 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }}

# Only setup & build if there was no build cache hit
- name: Use Node.js 16
- name: Use Node 16
uses: actions/setup-node@v3
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
with:
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
Expand All @@ -64,14 +64,12 @@ jobs:
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }}

- run: yarn install --frozen-lockfile --prefer-offline
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline

- name: lint
run: yarn lint

outputs:
yarn-cache-dir: ${{ steps.get-yarn-cache-dir.outputs.dir }}

chromatic:
name: Chromatic
runs-on: ubuntu-latest
Expand All @@ -82,14 +80,15 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js 16
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore build cache
Expand All @@ -115,14 +114,15 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore build cache
Expand All @@ -145,14 +145,15 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- run: yarn install --frozen-lockfile --prefer-offline
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
name: Restore build cache
Expand Down
107 changes: 88 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,67 @@ on:
- main

jobs:
release:
name: Release
build:
name: Build packages
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v3
name: Check for build cache
id: build-cache
with:
fetch-depth: 0
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/src/', '!**/node_modules', '!**/dist') }}

- name: Setup Node.js 16.x
uses: actions/setup-node@v1
# 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.x
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'

- name: Install Dependencies
run: yarn
- name: Install
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn install --frozen-lockfile --prefer-offline

- name: Build packages
- name: build
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn build

- name: Build typescript
run: yarn tsc
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: Build TSDoc
run: yarn build:docs
- 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: Establish Chromatic baseline
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
Expand All @@ -41,6 +75,35 @@ jobs:
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: Create Release Pull Request
id: changesets
uses: changesets/action@v1
Expand All @@ -51,7 +114,13 @@ jobs:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'

notify:
name: Notify Slack & Website
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Dispatch to Website repo
if: ${{ needs.release.outputs.published == 'true' }}
uses: peter-evans/repository-dispatch@v2
continue-on-error: true
with:
Expand All @@ -60,8 +129,8 @@ jobs:
event-type: release-leafygreen-ui

- name: Notify Slack channel of new releases
if: steps.changesets.outputs.published == 'true'
if: ${{ needs.release.outputs.published == 'true' }}
id: slackbot
run: yarn slackbot '${{steps.changesets.outputs.publishedPackages}}'
run: yarn slackbot '${{ needs.release.outputs.publishedPackages }}'
env:
SLACK_BOT_TOKEN: '${{secrets.SLACK_BOT_TOKEN}}'
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}'

0 comments on commit 4db5fb5

Please sign in to comment.