-
Notifications
You must be signed in to change notification settings - Fork 8
84 lines (69 loc) · 2.39 KB
/
Copy pathpublish-react.yml
File metadata and controls
84 lines (69 loc) · 2.39 KB
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
name: Publish React package
on:
workflow_dispatch:
inputs:
ref:
description: Branch, tag, or commit to publish
required: true
default: main
version:
description: Public version to publish
required: true
default: 0.1.0
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 26.4.0
registry-url: https://registry.npmjs.org
scope: '@ornery'
always-auth: true
cache: npm
- name: Install Rust toolchain
uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
uses: taiki-e/install-action@v2
with:
tool: wasm-pack
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Verify core version is published
run: |
VERSION="${{ inputs.version }}"
for attempt in $(seq 1 20); do
if npm view "@ornery/ui-grid-core@$VERSION" version >/dev/null 2>&1; then
echo "Found @ornery/ui-grid-core@$VERSION on npm"
exit 0
fi
echo "Waiting for @ornery/ui-grid-core@$VERSION to appear on npm (attempt $attempt/20)"
sleep 15
done
echo "@ornery/ui-grid-core@$VERSION was not available on npm in time" >&2
exit 1
- name: Build the Vanilla package (for type resolution)
run: npm run build:vanilla
- name: Build the React package
run: npm run build --prefix projects/ui-grid-react
- name: Set the package version
run: |
VERSION="${{ inputs.version }}"
cd projects/ui-grid-react
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ "$CURRENT_VERSION" != "$VERSION" ]; then
npm version "$VERSION" --no-git-tag-version
else
echo "Package version already set to $VERSION"
fi
- name: Publish to npm
run: npm publish ./projects/ui-grid-react --access public --registry=https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}