-
Notifications
You must be signed in to change notification settings - Fork 6
64 lines (63 loc) · 1.8 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 }}