-
-
Notifications
You must be signed in to change notification settings - Fork 1
232 lines (197 loc) · 6.92 KB
/
prepare-release.yml
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
222
223
224
225
226
227
228
229
230
231
232
name: Notion Repackaged Enhanced
on:
workflow_dispatch:
inputs:
notion_version:
description: "Notion version"
required: true
default: "3.9.1"
custom_version:
description: "Custom target version"
required: true
default: "1.0.0"
notion_enhancer_commit:
description: "Notion enhancer commit"
required: true
default: "7fe9bb2543cbc8f0c74adb0b90104281528c4af3"
env:
NOTION_DESKTOP_BASE_URL: https://desktop-release.notion-static.com
concurrency:
cancel-in-progress: true
group: prepare-release
jobs:
prepare-source:
name: Prepare source
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create work directory
shell: bash
run: rm -rf work; mkdir work
- name: Download release
working-directory: work
shell: bash
env:
NOTION_VERSION: ${{ github.event.inputs.notion_version }}
run: curl -o Notion.exe ${NOTION_DESKTOP_BASE_URL}/Notion%20Setup%20${NOTION_VERSION}.exe
- name: Extract exe
working-directory: work
shell: bash
run: 7z x Notion.exe -oexe-extracted -y
- name: Extract app package
working-directory: work
shell: bash
run: 7z x exe-extracted/\$PLUGINSDIR/app-64.7z -oapp-extracted -y
- name: Extract asar
working-directory: work
shell: bash
run: npx @electron/asar extract app-extracted/resources/app.asar asar-extracted
- name: Copy necessary files to source
working-directory: work
shell: bash
run: |
rm -rf clean-source
mkdir clean-source
cp -r asar-extracted/. clean-source
rm -rf clean-source/node_modules
mkdir -p clean-source/extraResources
cp app-extracted/resources/trayIcon.ico clean-source/extraResources
- name: Fix and clean package.json
working-directory: work/clean-source
shell: bash
run: |
jq 'del(.overrides)' package.json \
| jq 'del(.scripts["postinstall"])' \
| jq 'del(.dependencies["@notionhq/shared"])' \
| jq 'del(.dependencies["@notionhq/shared-intl"])' \
| jq 'del(.dependencies["@notionhq/shared-utils"])' \
| jq 'del(.dependencies["@notionhq/test-framework"])' \
> package.json.tmp
rm package.json && mv package.json.tmp package.json
- name: Change version in package.json
working-directory: work/clean-source
shell: bash
env:
CUSTOM_VERSION: ${{ github.event.inputs.custom_version }}
run: |
jq --arg custom_version "${CUSTOM_VERSION}" \
'.version=$custom_version' package.json \
> package.json.tmp
rm package.json && mv package.json.tmp package.json
- name: Copy custom electron-forge config
shell: bash
run: cp forge.config.js work/clean-source
- name: Install/upgrade electron-forge packages
working-directory: work/clean-source
shell: bash
env:
ELECTRON_FORGE_VERSION: 7.4.0
run: |
npm install --package-lock-only --no-package-lock --save-dev \
@electron-forge/cli@${ELECTRON_FORGE_VERSION} \
@electron-forge/core@${ELECTRON_FORGE_VERSION} \
@electron-forge/maker-deb@${ELECTRON_FORGE_VERSION} \
@electron-forge/maker-dmg@${ELECTRON_FORGE_VERSION} \
@electron-forge/maker-rpm@${ELECTRON_FORGE_VERSION} \
@electron-forge/maker-zip@${ELECTRON_FORGE_VERSION} \
@electron-forge/plugin-auto-unpack-natives@${ELECTRON_FORGE_VERSION} \
@electron-forge/plugin-fuses@${ELECTRON_FORGE_VERSION} \
@electron-forge/plugin-webpack@${ELECTRON_FORGE_VERSION} \
@electron-forge/publisher-github@${ELECTRON_FORGE_VERSION} \
@electron-forge/shared-types@${ELECTRON_FORGE_VERSION} \
@electron-forge/maker-squirrel@${ELECTRON_FORGE_VERSION}
npm install --package-lock-only --no-package-lock --save-optional \
- name: Install enhancer package
working-directory: work/clean-source
env:
NOTION_ENHANCER_COMMIT: ${{ github.event.inputs.notion_enhancer_commit }}
run: |
npm install --package-lock-only --no-package-lock --save \
git://github.com/notion-enhancer/notion-enhancer.git#${NOTION_ENHANCER_COMMIT}
- name: Install additional packages
working-directory: work/clean-source
shell: bash
env:
GLOB_VERSION: 10.4.1
run: |
npm install --package-lock-only --no-package-lock --save-dev \
glob@${GLOB_VERSION}
- name: Update lockfile
working-directory: work/clean-source
shell: bash
run: npm install --package-lock-only
- name: Zip source directory
working-directory: work
shell: bash
run: 7z a source.zip clean-source/.
- name: Save source as artifact
uses: actions/upload-artifact@v3
with:
name: source
path: work/source.zip
build-app:
name: Build app
needs: [prepare-source]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
target: [windows, linux, macos]
include:
- target: windows
os: windows-latest
arch: x64
- target: linux
os: ubuntu-latest
arch: x64
- target: macos
os: macos-latest
arch: x64,arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create work directory
shell: bash
run: rm -rf work; mkdir work
- name: Download source artifact
uses: actions/download-artifact@v3
with:
name: source
path: work
- name: Install system packages
shell: bash
run: sudo apt-get update && sudo apt-get install -y rpm dpkg fakeroot
if: matrix.os == 'ubuntu-latest'
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Unzip source
working-directory: work
shell: bash
run: 7z x source.zip -osource
- name: Install packages
working-directory: work/source
shell: bash
run: npm install
- name: Build and publish app
working-directory: work/source
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-forge publish --arch=${{ matrix.arch }}
cleanup:
name: Artifacts cleanup
runs-on: ubuntu-latest
if: always()
needs: [build-app]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: source