-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (97 loc) · 4.12 KB
/
Copy pathrelease.yml
File metadata and controls
115 lines (97 loc) · 4.12 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: Release
# Manual-only release for v0.x. Pick patch / minor / major from the Actions UI.
# Auto-triggers commented out until the pipeline is proven across 2-3 manual
# releases. Uncomment to mirror sdk-typescript and sdk-python (cron + spec
# dispatch from the main app) once we trust the build end to end.
on:
workflow_dispatch:
inputs:
version_bump:
description: 'patch | minor | major'
required: false
default: 'patch'
# repository_dispatch:
# types: [openapi-updated]
# schedule:
# - cron: '0 6 * * *'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- name: Regenerate types from spec
run: bun run generate
- name: Sync docs from spec
run: bun run docs:sync
- name: Check if spec changed
id: diff
run: |
OLD=$(git show HEAD:specs/openapi.json 2>/dev/null | jq -cS '{paths, components}' || echo '')
NEW=$(jq -cS '{paths, components}' specs/openapi.json)
if [ "$OLD" = "$NEW" ]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Typecheck
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run typecheck
- name: Build
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run build
- name: Unit tests
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run test
- name: Install Playwright browsers
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bunx playwright install --with-deps chromium firefox webkit
- name: E2E tests
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run test:e2e
- name: Bump versions and rebuild
id: bump
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
BUMP="${{ github.event.inputs.version_bump || 'patch' }}"
(cd packages/ui && npm version "$BUMP" --no-git-tag-version)
(cd packages/ui-react && npm version "$BUMP" --no-git-tag-version)
VERSION=$(node -p "require('./packages/ui/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
bun run build
- name: Publish @roxyapi/ui
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
npm install -g npm@latest
(cd packages/ui && npm publish --access public --provenance)
- name: Publish @roxyapi/ui-react
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
(cd packages/ui-react && npm publish --access public --provenance)
- name: Commit, tag, push
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION=$(node -p "require('./packages/ui/package.json').version")
git add packages/ packages/ui/dist packages/ui-react/dist registry/ specs/openapi.json README.md AGENTS.md
git commit -m "release: v$VERSION"
git tag "v$VERSION"
git push --follow-tags
- name: Create GitHub release
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.bump.outputs.version }}
generate_release_notes: true
make_latest: 'true'