Skip to content

Commit

Permalink
✨ Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
XionWCFM committed Mar 27, 2024
1 parent 64346a9 commit 21c7bba
Showing 1 changed file with 47 additions and 23 deletions.
70 changes: 47 additions & 23 deletions .github/workflows/lint-test-build.yml
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

0 comments on commit 21c7bba

Please sign in to comment.