Skip to content

Workflow file for this run

name: Build & Test & Maybe Publish
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
release:
types: [ published ]
jobs:
build_and_maybe_publish:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ hashFiles('./demo/docker-compose.yml') }}
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"
- name: Build & Test Lib
working-directory: lib
run: |
npm ci
npm run build
- name: Build & Test Demo
working-directory: demo
run: |
docker compose up -d
npm ci
npx playwright install --with-deps
npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: demo/playwright-report/
retention-days: 30
- name: Copy Readme and License
if: github.event_name == 'release'
working-directory: lib
run: cp ../{README.md,LICENSE} .
shell: bash
- name: prerelease
if: github.event_name == 'release' && github.event.release.prerelease
working-directory: lib
run: npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: publish
if: github.event_name == 'release' && !github.event.release.prerelease
working-directory: lib
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}