Skip to content

Notion Repackaged Enhanced #21

Notion Repackaged Enhanced

Notion Repackaged Enhanced #21

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 \
[email protected]
- 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,arm64
- target: linux
os: ubuntu-latest
arch: x64,arm64
- target: macos
os: macos-latest
arch: universal
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