-
-
Notifications
You must be signed in to change notification settings - Fork 180
78 lines (64 loc) · 2.34 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
78 lines (64 loc) · 2.34 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
name: Deploy Docs
on:
workflow_run:
workflows:
- Release
types:
- completed
branches:
- main
workflow_dispatch:
permissions:
contents: write
concurrency:
group: deploy-docs
cancel-in-progress: false
jobs:
deploy-docs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || contains(fromJSON('["success","skipped"]'), github.event.workflow_run.conclusion)
steps:
- uses: actions/checkout@v6
with:
ref: main
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
registry-url: https://registry.npmjs.org
- name: Setup pnpm
uses: pnpm/action-setup@v5
- name: Use latest published package
run: |
package_version="$(node -p "require('./package.json').version")"
latest_version="$(npm view react-easy-crop version)"
for attempt in {1..18}; do
if [ "$latest_version" = "$package_version" ]; then
break
fi
echo "npm latest is ${latest_version}; waiting for ${package_version} (${attempt}/18)"
sleep 10
latest_version="$(npm view react-easy-crop version)"
done
if [ "$latest_version" != "$package_version" ]; then
echo "::warning::Expected npm latest ${package_version}, got ${latest_version}; deploying docs with npm latest."
fi
REACT_EASY_CROP_VERSION="$latest_version" node <<'NODE'
const fs = require('fs')
const path = 'docs/package.json'
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'))
pkg.dependencies['react-easy-crop'] = process.env.REACT_EASY_CROP_VERSION
fs.writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`)
NODE
echo "Using react-easy-crop@${latest_version}"
- name: Install docs dependencies
run: pnpm --dir docs install --ignore-workspace --no-frozen-lockfile --ignore-scripts
- name: Deploy docs to GitHub Pages
run: pnpm --dir docs deploy
env:
CURRENT_BRANCH: main
GIT_PASS: ${{ secrets.GITHUB_TOKEN }}
GIT_USER: github-actions[bot]
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_USER_NAME: github-actions[bot]
USE_SSH: false