-
Notifications
You must be signed in to change notification settings - Fork 1
221 lines (189 loc) · 6.8 KB
/
release.yml
File metadata and controls
221 lines (189 loc) · 6.8 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: Release
on:
push:
branches: [main]
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Run unit tests
run: bun run test:unit
version-bump:
needs: test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump.outputs.version }}
tag: ${{ steps.bump.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: bump
run: |
npm version patch --no-git-tag-version
VERSION=$(node -p "require('./package.json').version")
sed -i "s/var APP_VERSION = '.*'/var APP_VERSION = '$VERSION'/" editors/desktop-stub.js
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
git add package.json editors/desktop-stub.js
git commit -m "chore: bump version to $VERSION [skip ci]"
git tag "v$VERSION"
git push origin main --tags
build-sdk:
needs: version-bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version-bump.outputs.tag }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Cache SDK build
id: sdk-cache
uses: actions/cache@v4
with:
path: |
editors/sdkjs/cell/sdk-all.js
editors/sdkjs/cell/sdk-all-min.js
editors/sdkjs/word/sdk-all.js
editors/sdkjs/word/sdk-all-min.js
editors/sdkjs/slide/sdk-all.js
editors/sdkjs/slide/sdk-all-min.js
editors/sdkjs/visio/sdk-all.js
editors/sdkjs/visio/sdk-all-min.js
key: sdk-build-${{ hashFiles('sdkjs/common/**/*.js', 'sdkjs/cell/**/*.js', 'sdkjs/word/**/*.js', 'sdkjs/slide/**/*.js', 'sdkjs/visio/**/*.js', 'sdkjs/build/Gruntfile.js') }}
- name: Build SDK
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: bun run build
- name: Upload SDK artifact
uses: actions/upload-artifact@v4
with:
name: sdk-build
path: |
editors/sdkjs/cell/sdk-all.js
editors/sdkjs/cell/sdk-all-min.js
editors/sdkjs/word/sdk-all.js
editors/sdkjs/word/sdk-all-min.js
editors/sdkjs/slide/sdk-all.js
editors/sdkjs/slide/sdk-all-min.js
editors/sdkjs/visio/sdk-all.js
editors/sdkjs/visio/sdk-all-min.js
build:
needs: [version-bump, build-sdk]
strategy:
matrix:
include:
- os: macos-14
platform: darwin-arm64
zip_name: oo-editors-darwin-arm64.zip
- os: macos-15-intel
platform: darwin-x64
zip_name: oo-editors-darwin-x64.zip
- os: windows-latest
platform: windows-x64
zip_name: oo-editors-windows-x64.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version-bump.outputs.tag }}
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Download SDK build
uses: actions/download-artifact@v4
with:
name: sdk-build
path: editors/sdkjs
- name: Cache converter
uses: actions/cache@v4
with:
path: converter
key: converter-${{ runner.os }}-${{ runner.arch }}-v9.1.0
- name: Download converter
run: bun download-converter.js
- name: Bundle VC++ runtime DLLs (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Copy-Item vendor/vcruntime/*.dll converter/
Get-ChildItem converter/*.dll | ForEach-Object { Write-Output "Bundled $($_.Name) ($($_.Length) bytes)" }
- name: Build allfontsgen
run: bun scripts/build_allfontsgen.js
- name: Install production dependencies
run: bun install --production
- name: Create release bundle (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p bundle
bunx esbuild server.js --bundle --platform=node --minify --outfile=bundle/server.js
cp package.json bundle/
cp -r node_modules bundle/
cp -r converter bundle/
cp -r editors bundle/
mkdir -p bundle/scripts
cp scripts/generate_office_fonts.js bundle/scripts/
mkdir -p bundle/assets/onlyoffice-fontdata
cd bundle && zip -r ../${{ matrix.zip_name }} .
- name: Create release bundle (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path bundle
bunx esbuild server.js --bundle --platform=node --minify --outfile=bundle/server.js
Copy-Item package.json -Destination bundle/
Copy-Item -Recurse node_modules bundle/
Copy-Item -Recurse converter bundle/
Copy-Item -Recurse editors bundle/
New-Item -ItemType Directory -Force -Path bundle/scripts
Copy-Item scripts/generate_office_fonts.js -Destination bundle/scripts/
New-Item -ItemType Directory -Force -Path bundle/assets/onlyoffice-fontdata
Compress-Archive -Path bundle/* -DestinationPath ${{ matrix.zip_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.zip_name }}
path: ${{ matrix.zip_name }}
release:
needs: [version-bump, build]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: oo-editors-*
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version-bump.outputs.tag }}
name: Release ${{ needs.version-bump.outputs.version }}
body: |
## Downloads
| Platform | Download |
|----------|----------|
| macOS ARM64 (Apple Silicon) | `oo-editors-darwin-arm64.zip` |
| macOS x64 (Intel) | `oo-editors-darwin-x64.zip` |
| Windows x64 | `oo-editors-windows-x64.zip` |
## First Run
1. Extract the zip
2. Run `node server.js` (requires Node.js)
3. Font metadata will be generated on first launch
files: |
artifacts/*.zip