Skip to content

Commit 94e0932

Browse files
committed
revert to jamezrin's separated build scripts
1 parent 6e9f87b commit 94e0932

File tree

10 files changed

+347
-275
lines changed

10 files changed

+347
-275
lines changed
Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
name: repackage-notion-app
1+
name: Notion Repackaged Main
22

33
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'notion-repackaged.sh'
8+
- '.github/workflows/notion-repackaged.yml'
9+
410
workflow_dispatch:
511
inputs: {}
612

@@ -9,26 +15,31 @@ env:
915

1016
jobs:
1117
preload-variables:
12-
name: preload variables
18+
name: Preload variables
1319
runs-on: ubuntu-latest
1420
steps:
1521
- uses: actions/checkout@v2
1622
- id: preload-variables
17-
name: load variables and set them as outputs
23+
name: Load variables and set them as outputs
1824
run: |
19-
source env.sh
25+
source notion-repackaged.sh
26+
2027
echo "::set-output name=notion_version::$NOTION_VERSION"
21-
echo "::set-output name=notion_repackaged_edition::$NOTION_REPACKAGED_EDITION"
2228
echo "::set-output name=notion_repackaged_revision::$NOTION_REPACKAGED_REVISION"
29+
echo "::set-output name=notion_download_hash::$NOTION_DOWNLOAD_HASH"
30+
echo "::set-output name=notion_enhancer_commit::$NOTION_ENHANCER_COMMIT"
31+
32+
NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}"
2333
echo "::set-output name=notion_repackaged_version_rev::$NOTION_REPACKAGED_VERSION_REV"
2434
outputs:
2535
notion_version: ${{ steps.preload-variables.outputs.notion_version }}
26-
notion_repackaged_edition: ${{ steps.preload-variables.outputs.notion_repackaged_edition }}
2736
notion_repackaged_revision: ${{ steps.preload-variables.outputs.notion_repackaged_revision }}
2837
notion_repackaged_version_rev: ${{ steps.preload-variables.outputs.notion_repackaged_version_rev }}
38+
notion_download_hash: ${{ steps.preload-variables.outputs.notion_download_hash }}
39+
notion_enhancer_commit: ${{ steps.preload-variables.outputs.notion_enhancer_commit }}
2940

3041
create-release:
31-
name: create release
42+
name: Create release
3243
runs-on: ubuntu-latest
3344
needs: [preload-variables]
3445
steps:
@@ -38,42 +49,66 @@ jobs:
3849
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3950
with:
4051
version: ${{ needs.preload-variables.outputs.notion_repackaged_version_rev }}
41-
tag: v${{ needs.preload-variables.outputs.notion_repackaged_version_rev }}
4252

43-
generate-sources:
44-
name: extract and patch vanilla and enhanced sources
53+
make-vanilla-sources:
54+
name: Make vanilla sources
4555
runs-on: ubuntu-latest
46-
needs: []
56+
needs: [preload-variables]
57+
env:
58+
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
59+
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }}
4760
steps:
4861
- uses: actions/checkout@v2
49-
- name: install build dependencies
50-
run: sudo apt install --no-install-recommends -y curl p7zip-full coreutils jq git imagemagick icnsutils
51-
- name: run build script
52-
run: ./build.sh --reset
53-
- name: zip vanilla source dir with 7z
62+
- name: Download official Windows build
63+
env:
64+
NOTION_DOWNLOAD_HASH: ${{ needs.preload-variables.outputs.notion_download_hash }}
65+
run: scripts/download-exe.sh
66+
- name: Extract sources from Windows Build
67+
run: scripts/extract-src.sh
68+
- name: Zip sources dir with 7z
5469
working-directory: build
5570
run: 7z a vanilla-src.zip vanilla-src
56-
- name: save vanilla source as artifact
71+
- name: Save vanilla sources as artifact
5772
uses: actions/upload-artifact@v2
5873
with:
5974
name: vanilla-sources
6075
path: build/vanilla-src.zip
61-
- name: zip enhanced source dir with 7z
76+
77+
make-enhanced-sources:
78+
name: Make enhanced sources
79+
needs: [make-vanilla-sources, preload-variables]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v2
83+
- name: Retrieve saved vanilla sources
84+
uses: actions/download-artifact@v2
85+
with:
86+
name: vanilla-sources
87+
path: build/vanilla-src.zip
88+
- name: Unzip sources with 7z
89+
working-directory: build
90+
run: 7z x vanilla-src.zip
91+
- name: Install icnsutils
92+
run: sudo apt-get install -y icnsutils
93+
- name: Enhance extracted sources
94+
env:
95+
NOTION_ENHANCER_COMMIT: ${{ needs.preload-variables.outputs.notion_enhancer_commit }}
96+
run: scripts/enhance-src.sh
97+
- name: Zip sources dir with 7z
6298
working-directory: build
6399
run: 7z a enhanced-src.zip enhanced-src
64-
- name: save enhanced source as artifact
100+
- name: Save enhanced sources as artifact
65101
uses: actions/upload-artifact@v2
66102
with:
67103
name: enhanced-sources
68104
path: build/enhanced-src.zip
69105

70106
build-app:
71-
name: build app
72-
needs: [create-release, generate-sources]
107+
name: Build app
108+
needs: [make-vanilla-sources, make-enhanced-sources, preload-variables, create-release]
73109
runs-on: ${{ matrix.os }}
74110
env:
75111
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
76-
NOTION_REPACKAGED_EDITION: ${{ needs.preload-variables.outputs.notion_repackaged_edition }}
77112
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }}
78113
strategy:
79114
matrix:
@@ -96,34 +131,34 @@ jobs:
96131
- uses: actions/setup-node@v1
97132
with:
98133
node-version: 14
99-
- name: retrieve saved sources
134+
- name: Retrieve saved sources
100135
uses: actions/download-artifact@v2
101136
with:
102137
name: ${{ matrix.edition }}-sources
103-
path: build/${{ matrix.edition }}-src.zip
104-
- name: unzip sources with 7z
105-
run: 7z x build/${{ matrix.edition }}-src.zip
106-
- name: install linux build dependencies
138+
path: sources.zip
139+
- name: Unzip sources with 7z
140+
run: 7z x sources.zip
141+
- name: Install Linux build dependencies
107142
if: matrix.os == 'ubuntu-latest'
108143
run: sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools
109-
- name: install dependencies
144+
- name: Install dependencies
110145
working-directory: ${{ matrix.edition }}-src
111146
run: npm install
112-
- name: run patch-package
147+
- name: Run patch-package
113148
working-directory: ${{ matrix.edition }}-src
114149
run: npx patch-package
115-
- name: install electron and electron-builder
150+
- name: Install electron and electron-builder
116151
working-directory: ${{ matrix.edition }}-src
117152
run: npm install electron@11 electron-builder --save-dev
118-
- name: run electron-builder
153+
- name: Run electron-builder
119154
working-directory: ${{ matrix.edition }}-src
120155
env:
121156
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122157
NOTION_REPACKAGED_EDITION: ${{ matrix.edition }}
123-
run: node_modules/.bin/electron-builder --${{ matrix.target }} -c ../electron-builder.js
158+
run: npx electron-builder --${{ matrix.target }} -c ../electron-builder.js
124159

125160
cleanup:
126-
name: cleanup artifacts
161+
name: Cleanup artifacts
127162
if: always()
128163
needs: [build-app]
129164
strategy:
@@ -133,4 +168,4 @@ jobs:
133168
steps:
134169
- uses: geekyeggo/delete-artifact@v1
135170
with:
136-
name: ${{ matrix.edition }}-sources
171+
name: '${{ matrix.edition }}-sources'

0 commit comments

Comments
 (0)