-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,60 @@ | ||
name: Release | ||
|
||
name: Lint, Test, and Build in Parallel | ||
on: [push] | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
setup-cache: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
cache-key: ${{ steps.cache-keys.outputs.cache-key }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
|
||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Generate cache key | ||
id: cache-keys | ||
run: | | ||
CACHE_DIR=$(yarn cache dir) | ||
echo "Cache directory: $CACHE_DIR" | ||
mkdir -p $CACHE_DIR | ||
echo "::set-output name=cache-key::$CACHE_DIR" | ||
lint: | ||
needs: setup-cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
version: yarn changeset version | ||
publish: yarn release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Send a Slack notification if a publish happens | ||
if: steps.changesets.outputs.published == 'true' | ||
run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!" | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
cache-dependency-path: ${{ needs.setup-cache.outputs.cache-key }} | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
test: | ||
needs: setup-cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
cache-dependency-path: ${{ needs.setup-cache.outputs.cache-key }} | ||
|
||
- name: Run Tests | ||
run: yarn test:all | ||
|
||
build: | ||
needs: setup-cache | ||
runs |