-
-
Notifications
You must be signed in to change notification settings - Fork 53
179 lines (169 loc) · 6.45 KB
/
notion-repackaged.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
name: Notion Repackaged Main
on:
push:
branches: [main]
paths:
- 'notion-repackaged.sh'
- '.github/workflows/notion-repackaged.yml'
workflow_dispatch:
inputs: {}
env:
NOTION_REPACKAGED_DEBUG: true
jobs:
preload-variables:
name: Preload variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: preload-variables
name: Load variables and set them as outputs
run: |
source notion-repackaged.sh
echo "::set-output name=notion_version::$NOTION_VERSION"
echo "::set-output name=notion_repackaged_revision::$NOTION_REPACKAGED_REVISION"
echo "::set-output name=notion_download_hash::$NOTION_DOWNLOAD_HASH"
echo "::set-output name=notion_enhancer_desktop_commit::$NOTION_ENHANCER_DESKTOP_COMMIT"
NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}"
echo "::set-output name=notion_repackaged_version_rev::$NOTION_REPACKAGED_VERSION_REV"
outputs:
notion_version: ${{ steps.preload-variables.outputs.notion_version }}
notion_repackaged_revision: ${{ steps.preload-variables.outputs.notion_repackaged_revision }}
notion_repackaged_version_rev: ${{ steps.preload-variables.outputs.notion_repackaged_version_rev }}
notion_download_hash: ${{ steps.preload-variables.outputs.notion_download_hash }}
notion_enhancer_desktop_commit: ${{ steps.preload-variables.outputs.notion_enhancer_desktop_commit }}
create-release:
name: Create release
runs-on: ubuntu-latest
needs: [preload-variables]
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ needs.preload-variables.outputs.notion_repackaged_version_rev }}
tag: v${{ needs.preload-variables.outputs.notion_repackaged_version_rev }}
make-vanilla-sources:
name: Make vanilla sources
runs-on: ubuntu-latest
needs: [preload-variables]
env:
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }}
steps:
- uses: actions/checkout@v2
- name: Install moreutils
run: sudo apt-get install -y moreutils
- name: Download official Windows build
env:
NOTION_DOWNLOAD_HASH: ${{ needs.preload-variables.outputs.notion_download_hash }}
run: scripts/download-exe.sh
- name: Extract sources from Windows Build
run: scripts/extract-src.sh
- name: Zip sources dir with 7z
working-directory: build
run: 7z a vanilla-src.zip vanilla-src
- name: Save vanilla sources as artifact
uses: actions/upload-artifact@v2
with:
name: vanilla-sources
path: build/vanilla-src.zip
make-enhanced-sources:
name: Make enhanced sources
needs: [make-vanilla-sources, preload-variables]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install icnsutils and moreutils
run: sudo apt-get install -y icnsutils moreutils
- name: Force to use HTTPS instead of SSH
run: git config --global url."https://github.com/".insteadOf "[email protected]:"
- name: Retrieve saved vanilla sources
uses: actions/download-artifact@v2
with:
name: vanilla-sources
path: build/vanilla-src.zip
- name: Unzip sources with 7z
working-directory: build
run: 7z x vanilla-src.zip
- name: Enhance extracted sources
env:
NOTION_ENHANCER_DESKTOP_COMMIT: ${{ needs.preload-variables.outputs.notion_enhancer_desktop_commit }}
run: scripts/enhance-src.sh
- name: Zip sources dir with 7z
working-directory: build
run: 7z a enhanced-src.zip enhanced-src
- name: Save enhanced sources as artifact
uses: actions/upload-artifact@v2
with:
name: enhanced-sources
path: build/enhanced-src.zip
build-app:
name: Build app
needs: [make-vanilla-sources, make-enhanced-sources, preload-variables, create-release]
runs-on: ${{ matrix.os }}
env:
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }}
strategy:
matrix:
target: [windows, linux, macos]
edition: [vanilla, enhanced]
include:
- target: windows
os: windows-latest
- target: linux
os: ubuntu-latest
- target: macos
os: macos-latest
exclude:
- target: windows
edition: vanilla
- target: macos
edition: vanilla
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- name: Retrieve saved sources
uses: actions/download-artifact@v2
with:
name: ${{ matrix.edition }}-sources
path: sources.zip
- name: Unzip sources with 7z
run: 7z x sources.zip
- name: Install Linux build dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools
- name: Install dependencies
working-directory: ${{ matrix.edition }}-src
run: npm install
- name: Run patch-package
working-directory: ${{ matrix.edition }}-src
run: npx patch-package
- name: Install electron and electron-builder
working-directory: ${{ matrix.edition }}-src
run: npm install electron@11 electron-builder --save-dev
- name: Run electron-builder
working-directory: ${{ matrix.edition }}-src
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_REPACKAGED_EDITION: ${{ matrix.edition }}
run: npx electron-builder --${{ matrix.target }} -c ../electron-builder.js
- name: Print packages md5 checksums
working-directory: ${{ matrix.edition }}-src
run: find ./dist/ -maxdepth 1 -type f -exec openssl md5 {} +
shell: bash
cleanup:
name: Cleanup artifacts
if: always()
needs: [build-app]
strategy:
matrix:
edition: [vanilla, enhanced]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: '${{ matrix.edition }}-sources'