-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (83 loc) · 2.55 KB
/
main.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 📢 Test & Release
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
pull-requests: write
pages: write
id-token: write
jobs:
test:
name: 🧪 tests
runs-on: ubuntu-latest
steps:
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
with:
node-version: 20
pnpm-version: 8
- run: echo "PUPPETEER_VERSION=$(pnpm ls puppeteer --json | jq '.[0].devDependencies.puppeteer.version' -r)" >> $GITHUB_ENV
shell: bash
- uses: actions/cache@v4
with:
path: ~/.cache/puppeteer/chrome
key: ${{ runner.os }}-puppeteer-chromium-${{ env.PUPPETEER_VERSION }}
restore-keys: ${{ runner.os }}-puppeteer-chromium-
- name: install chromium
run: |
# very bad, but I do not found any other way to run
# a postinstall script of an already installed package
pnpm -C node_modules/puppeteer run postinstall
env:
PUPPETEER_DOWNLOAD_BASE_URL: https://storage.googleapis.com/chrome-for-testing-public
- name: 🧪 Run the tests
run: pnpm run test
docs:
name: 📖 docs
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
with:
node-version: 20
pnpm-version: 8
- uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
with:
install_command: pnpm install
build_command: pnpm run build && pnpm run build-storybook
path: storybook-static
release-please:
name: 📦 release
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: node
token: ${{ secrets.PAT }}
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.release_created }}
with:
version: 8
- run: |
pnpm install
pnpm build
if: ${{ steps.release.outputs.release_created }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}