search filters #2
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: Build, test, deploy, and publish | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
test: | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: yarn | |
- name: Compile Typescript | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
chromatic: | |
name: Run Chromatic | |
runs-on: ubuntu-latest | |
needs: test # Runs only after the 'test' job is successful | |
# Only run on push to main | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run Chromatic | |
uses: chromaui/action@latest | |
with: | |
# Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
publish: | |
name: Publish Package | |
runs-on: ubuntu-latest | |
needs: test # Runs only after the 'test' job is successful | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable yarn latest using corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build | |
- name: Setup .yarnrc.yml | |
run: | | |
yarn config set npmAlwaysAuth true | |
yarn config set npmAuthToken $NPM_AUTH_TOKEN | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Publish private package | |
run: yarn npm publish --access public |