Skip to content

Commit a679bf1

Browse files
authored
Fix publish and demo deployment (#53)
1 parent fd26e8b commit a679bf1

File tree

4 files changed

+56
-29
lines changed

4 files changed

+56
-29
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Run Tests
2+
3+
inputs:
4+
node-version:
5+
required: true
6+
type: string
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: ${{ inputs.node-version }}
15+
- run: npm i -g pnpm
16+
shell: bash
17+
- run: pnpm i --ignore-scripts
18+
shell: bash
19+
- run: pnpm cypress:install
20+
shell: bash
21+
- run: pnpm lint
22+
shell: bash
23+
- run: pnpm test
24+
shell: bash
25+
- name: Save Cypress output on failure
26+
if: ${{ failure() }}
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: cypress-output
30+
path: |
31+
cypress/screenshots/
32+
cypress/videos/
33+
cypress/downloads/
34+
retention-days: 7

.github/workflows/pr-tests.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,16 @@ name: PR Tests
22

33
on:
44
pull_request:
5-
branches: [ "main" ]
5+
branches: [main]
66

77
jobs:
8-
tests:
8+
run-tests:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
1212
node-version: [22.x]
1313
steps:
14-
- uses: actions/checkout@v4
15-
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: ${{ matrix.node-version }}
19-
- run: npm i -g pnpm
20-
- run: pnpm i --ignore-scripts
21-
- run: pnpm cypress:install
22-
- run: pnpm lint
23-
- run: pnpm test
24-
- name: Save Cypress Output
25-
if: ${{ failure() }}
26-
uses: actions/upload-artifact@v4
27-
with:
28-
name: cypress-output
29-
path: |
30-
cypress/screenshots/
31-
cypress/videos/
32-
cypress/downloads/
33-
retention-days: 7
14+
- uses: actions/checkout@v4
15+
- uses: ./.github/actions/run-tests
16+
with:
17+
node-version: ${{ matrix.node-version }}

.github/workflows/publish-new-release.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ on:
55
types: [created]
66

77
jobs:
8+
run-tests:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [22.x]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: ./.github/actions/run-tests
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
819
publish-npm:
20+
needs: run-tests
921
runs-on: ubuntu-latest
1022
strategy:
1123
matrix:
1224
node-version: [22.x]
1325
steps:
1426
- uses: actions/checkout@v4
15-
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v4
27+
- uses: actions/setup-node@v4
1728
with:
1829
node-version: ${{ matrix.node-version }}
1930
registry-url: https://registry.npmjs.org/
@@ -22,7 +33,6 @@ jobs:
2233
- run: cat package.json
2334
- run: npm i -g pnpm
2435
- run: pnpm i
25-
- run: pnpm test
2636
- run: pnpm publish-npm
2737
env:
2838
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
@@ -35,8 +45,7 @@ jobs:
3545
node-version: [22.x]
3646
steps:
3747
- uses: actions/checkout@v4
38-
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v4
48+
- uses: actions/setup-node@v4
4049
with:
4150
node-version: ${{ matrix.node-version }}
4251
- run: npm i -g pnpm
@@ -49,7 +58,8 @@ jobs:
4958
git config user.name "github-actions-bot"
5059
- name: Deploy to Github Pages
5160
run: |
61+
pnpm build-demo
5262
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
53-
pnpm deploy-demo -- -u "github-actions-bot <[email protected]>"
63+
npx gh-pages -d demo/build -u "github-actions-bot <[email protected]>"
5464
env:
5565
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"publish-npm": "pnpm clean && pnpm build && npm publish",
1919
"start-demo": "pnpm --prefix demo start",
2020
"build-demo": "pnpm --prefix demo build",
21-
"deploy-demo": "pnpm build-demo && gh-pages -d demo/build",
2221
"lint": "eslint .",
2322
"cypress:install": "cypress install",
2423
"test": "pnpm cypress run --component",

0 commit comments

Comments
 (0)