Repository navigation
Expand file tree
/
Copy pathupdate-design-system-dependency.yml
More file actions
115 lines (100 loc) · 4.13 KB
/
Copy pathupdate-design-system-dependency.yml
File metadata and controls
115 lines (100 loc) · 4.13 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Update design system dependency
on:
workflow_dispatch:
inputs:
version:
description: >-
Exact @arcadeai/design-system version to install. The monorepo publish
workflow passes the version it just published. Leave empty for latest.
required: false
type: string
permissions:
contents: write
pull-requests: write
jobs:
update-design-system:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The monorepo dispatches this workflow seconds after `bun publish`
# returns, but the npm registry takes several minutes to serve the new
# version. Resolving `latest` right away picks up the previous release,
# so when a version is given, wait until npm serves it and install it.
- name: Wait for requested version on npm
if: inputs.version != ''
env:
VERSION: ${{ inputs.version }}
run: |
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::error::Invalid version input: $VERSION"
exit 1
fi
for attempt in $(seq 1 20); do
if [ "$(npm view "@arcadeai/design-system@$VERSION" version --prefer-online 2>/dev/null)" = "$VERSION" ]; then
echo "@arcadeai/design-system@$VERSION is available on npm"
exit 0
fi
echo "Attempt $attempt: $VERSION not on npm yet, retrying in 30s"
sleep 30
done
echo "::error::@arcadeai/design-system@$VERSION did not appear on npm within 10 minutes"
exit 1
- name: Update @arcadeai/design-system
env:
VERSION: ${{ inputs.version || 'latest' }}
run: pnpm install "@arcadeai/design-system@$VERSION"
- name: Check for changes
id: check-changes
run: |
if [ -n "$(git status --porcelain package.json pnpm-lock.yaml)" ]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Run design-system compatibility tests
if: steps.check-changes.outputs.has_changes == 'true'
run: |
pnpm vitest run toolkit-docs-generator/tests/scripts/sync-toolkit-sidebar.test.ts toolkit-docs-generator/tests/sources/oauth-provider-resolver.test.ts
pnpm run build
# Compatibility tests and a production build run above, so this workflow
# does not depend on Test starting on the opened PR.
- name: Create pull request
if: steps.check-changes.outputs.has_changes == 'true'
id: cpr
uses: peter-evans/create-pull-request@v7
env:
HUSKY: 0
SKIP_HUSKY: 1
with:
token: ${{ github.token }}
commit-message: "chore: update @arcadeai/design-system to latest"
title: "chore: update @arcadeai/design-system to latest"
body: |
This PR updates `@arcadeai/design-system` to the latest published version.
It runs a design-system compatibility test gate before opening this PR.
If that gate fails, the workflow stops and no PR is created.
- Trigger: `${{ github.event_name }}`
- Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
add-paths: |
package.json
pnpm-lock.yaml
branch: automation/update-design-system-dependency
delete-branch: true
- name: Request team review
if: steps.check-changes.outputs.has_changes == 'true' && steps.cpr.outputs.pull-request-number != ''
continue-on-error: true
run: gh pr edit ${{ steps.cpr.outputs.pull-request-number }} --add-reviewer ArcadeAI/engineering-tools-and-dx
env:
GH_TOKEN: ${{ github.token }}