This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
build #149
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 | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: '0 16 * * 0' # sunday 16:00 | |
jobs: | |
build: | |
name: Node unit tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: ['16', '17', '18', '19', '20'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache .pnpm-store | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install dependencies | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
run_install: true | |
- name: Lint source | |
run: | | |
pnpm lint:check | |
- name: Build package | |
run: | | |
pnpm build | |
- name: Run tests | |
run: | | |
pnpm test:run | |
env: | |
CI: true | |
- name: 'Consume changesets' | |
if: github.event_name == 'push' && github.repository == 'nodecfdi/cfdiutils-elements' && matrix.node == 16 && github.ref == 'refs/heads/main' | |
uses: changesets/action@v1 | |
id: 'changesets' | |
with: | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: pnpm release | |
commit: 'chore: version bump' | |
title: Next release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 'Generate docs' | |
if: steps.changesets.outputs.published == 'true' | |
run: pnpm gen:docs | |
- name: Commit docs | |
if: steps.changesets.outputs.published == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'docs: generate docs' |