This repository has been archived by the owner on May 7, 2024. It is now read-only.
Tests #82
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: Tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
schedule: | |
# run tests monthly to prevent Algolia test index from being suspended due to inactivity | |
- cron: '0 0 1 * *' # at 00:00 UTC on 1st day of every month (https://crontab.guru) | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
cache-dependency-path: package.json | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run tests | |
id: tests | |
run: pnpm test | |
env: | |
VITE_ALGOLIA_APP_ID: ${{ secrets.VITE_ALGOLIA_APP_ID }} | |
VITE_ALGOLIA_SEARCH_KEY: ${{ secrets.VITE_ALGOLIA_SEARCH_KEY }} | |
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} | |
release: | |
runs-on: ubuntu-latest | |
needs: tests | |
if: github.event_name == 'release' && needs.tests.result == 'success' | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Build package and publish to NPM | |
run: | | |
npm install | |
npm run package | |
npm login --auth-mode=legacy | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |