Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to Notion v4.0.0 #134

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
10 changes: 5 additions & 5 deletions .github/workflows/gemfury-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
description: Release tag
required: true
env:
RELEASES_URL: 'https://github.com/notion-enhancer/notion-repackaged/releases'
RELEASES_URL: "https://github.com/notion-enhancer/notion-repackaged/releases"
RELEASE_VERSION: "${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.release_tag }}"
GEMFURY_PUSH_URL: 'push.fury.io/notion-repackaged/'
GEMFURY_PUSH_URL: "push.fury.io/notion-repackaged/"

jobs:
strip-revision:
Expand All @@ -22,7 +22,7 @@ jobs:
- id: strip-revision
run: |
RELEASE_VERSION_REV_STRIPPED=$(echo $RELEASE_VERSION | sed 's/^v//')
echo "::set-output name=release_version_rev_stripped::$RELEASE_VERSION_REV_STRIPPED"
echo "release_version_rev_stripped=$RELEASE_VERSION_REV_STRIPPED" >> $GITHUB_OUTPUT
outputs:
release_version_rev_stripped: ${{ steps.strip-revision.outputs.release_version_rev_stripped }}

Expand All @@ -37,9 +37,9 @@ jobs:
package_name: [notion-app, notion-app-enhanced]
include:
- package_type: deb
filename_format: '{0}_{1}_amd64.deb'
filename_format: "{0}_{1}_amd64.deb"
- package_type: rpm
filename_format: '{0}-{1}.x86_64.rpm'
filename_format: "{0}-{1}.x86_64.rpm"
steps:
- name: Reupload artifacts to Gemfury
env:
Expand Down
59 changes: 33 additions & 26 deletions .github/workflows/notion-repackaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: Notion Repackaged Main

on:
push:
branches: [main]
paths:
- 'notion-repackaged.sh'
- '.github/workflows/notion-repackaged.yml'
branches: [main, bump-notion-v400]

workflow_dispatch:
inputs: {}
Expand All @@ -18,33 +15,33 @@ jobs:
name: Preload variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- 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"
echo "notion_version=$NOTION_VERSION" >> $GITHUB_OUTPUT
echo "notion_repackaged_revision=$NOTION_REPACKAGED_REVISION" >> $GITHUB_OUTPUT
echo "notion_download_hash=$NOTION_DOWNLOAD_HASH" >> $GITHUB_OUTPUT
echo "notion_enhancer_desktop_commit=$NOTION_ENHANCER_DESKTOP_COMMIT" >> $GITHUB_OUTPUT

NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}"
echo "::set-output name=notion_repackaged_version_rev::$NOTION_REPACKAGED_VERSION_REV"
echo "notion_repackaged_version_rev=$NOTION_REPACKAGED_VERSION_REV" >> $GITHUB_OUTPUT
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 }}
notion_repackaged_version_rev: ${{ steps.preload-variables.outputs.notion_repackaged_version_rev }}

create-release:
name: Create release
runs-on: ubuntu-latest
needs: [preload-variables]
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
- uses: actions/checkout@v4
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -59,9 +56,11 @@ jobs:
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
NOTION_REPACKAGED_REVISION: ${{ needs.preload-variables.outputs.notion_repackaged_revision }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install moreutils
run: sudo apt-get install -y moreutils
- name: Install asar
run: npm install -g asar
- name: Download official Windows build
env:
NOTION_DOWNLOAD_HASH: ${{ needs.preload-variables.outputs.notion_download_hash }}
Expand All @@ -72,7 +71,7 @@ jobs:
working-directory: build
run: 7z a vanilla-src.zip vanilla-src
- name: Save vanilla sources as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: vanilla-sources
path: build/vanilla-src.zip
Expand All @@ -82,13 +81,15 @@ jobs:
needs: [make-vanilla-sources, preload-variables]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install icnsutils and moreutils
run: sudo apt-get install -y icnsutils moreutils
- name: Install asar
run: npm install -g asar
- 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
uses: actions/download-artifact@v4
with:
name: vanilla-sources
path: build/vanilla-src.zip
Expand All @@ -103,14 +104,20 @@ jobs:
working-directory: build
run: 7z a enhanced-src.zip enhanced-src
- name: Save enhanced sources as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
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]
needs:
[
make-vanilla-sources,
make-enhanced-sources,
preload-variables,
create-release,
]
runs-on: ${{ matrix.os }}
env:
NOTION_VERSION: ${{ needs.preload-variables.outputs.notion_version }}
Expand All @@ -132,12 +139,12 @@ jobs:
- target: macos
edition: vanilla
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 22
- name: Retrieve saved sources
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ${{ matrix.edition }}-sources
path: sources.zip
Expand All @@ -154,7 +161,7 @@ jobs:
run: npx patch-package
- name: Install electron and electron-builder
working-directory: ${{ matrix.edition }}-src
run: npm install electron@11 electron-builder --save-dev
run: npm install electron@33.2.0 electron-builder --save-dev
- name: Run electron-builder
working-directory: ${{ matrix.edition }}-src
env:
Expand All @@ -174,6 +181,6 @@ jobs:
edition: [vanilla, enhanced]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v1
- uses: geekyeggo/delete-artifact@v5
with:
name: '${{ matrix.edition }}-sources'
name: "${{ matrix.edition }}-sources"
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.1
22.11.0
42 changes: 25 additions & 17 deletions electron-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@ function ensureEnvVar(envVarName) {
return process.env[envVarName];
}

const editionEnvVar = ensureEnvVar('NOTION_REPACKAGED_EDITION'),
versionEnvVar = ensureEnvVar('NOTION_VERSION'),
revisionEnvVar = ensureEnvVar('NOTION_REPACKAGED_REVISION');
const envVars = {
Edition: ensureEnvVar('NOTION_REPACKAGED_EDITION'),
Version: ensureEnvVar('NOTION_VERSION'),
Revision: ensureEnvVar('NOTION_REPACKAGED_REVISION'),
}

const isVanilla = editionEnvVar === 'vanilla';
const isVanilla = envVars.Edition === 'vanilla';

const productName = isVanilla ? 'Notion' : 'Notion Enhanced',
productId = isVanilla ? 'notion-app' : 'notion-app-enhanced',
conflictProductId = !isVanilla ? 'notion-app' : 'notion-app-enhanced',
productDescription = isVanilla
? 'The all-in-one workspace for your notes and tasks'
: 'The all-in-one workspace for your notes and tasks, but enhanced';
const productMetadata = isVanilla ? {
name: 'Notion',
description: 'The all-in-one workspace for your notes and tasks',
id: 'notion-app',
conflictId: 'notion-app-enhanced',
} : {
name: 'Notion Enhanced',
description: 'The all-in-one workspace for your notes and tasks, but enhanced',
id: 'notion-app-enhanced',
conflictId: 'notion-app',
}

const fpmOptions = [
`--version=${versionEnvVar}`,
`--iteration=${revisionEnvVar}`,
`--conflicts=${conflictProductId}`,
`--version=${envVars.Version}`,
`--iteration=${envVars.Revision}`,
`--conflicts=${productMetadata.conflictId}`,
];

const combineTargetAndArch = (targets, architectures = ['x64', 'arm64']) =>
Expand All @@ -38,12 +45,13 @@ const getPublishProviders = (platform) => [

module.exports = {
asar: true,
productName: productName,
productName: productMetadata.name,
extraMetadata: {
description: productDescription,
description: productMetadata.description,
},
appId: 'com.github.notion-repackaged',
protocols: [{ name: 'Notion', schemes: ['notion'] }],
npmRebuild: false,
win: {
icon: 'icon.ico',
target: combineTargetAndArch(['nsis', 'zip'], ['x64']),
Expand All @@ -62,9 +70,9 @@ module.exports = {
mimeTypes: ['x-scheme-handler/notion'],
desktop: {
StartupNotify: 'true',
StartupWMClass: productId,
StartupWMClass: productMetadata.id,
},
target: combineTargetAndArch(['AppImage', 'deb', 'rpm', 'pacman', 'zip']),
target: combineTargetAndArch(['AppImage', 'deb', 'pacman', 'zip']), // FIXME: RPM build is broken, add ", 'rpm'" when fixed
publish: getPublishProviders('linux'),
},
nsis: {
Expand Down
6 changes: 3 additions & 3 deletions notion-repackaged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#

# Version of the original Notion App installer to repackage
export NOTION_VERSION=2.0.18
export NOTION_VERSION=4.0.0

# Revision of the current version
export NOTION_REPACKAGED_REVISION=1
export NOTION_REPACKAGED_REVISION=1.1

# The md5sum hash of the downloaded .exe for the installer
export NOTION_DOWNLOAD_HASH=31bb8b9d547cb5385b9f04017214a206
export NOTION_DOWNLOAD_HASH=9f9cd21ff2245fc27c2ceef224008720

# The commit of notion-enhancer/desktop to target
export NOTION_ENHANCER_DESKTOP_COMMIT=832db26d2e6a247d9e76847b2de50435fa7c40d2
10 changes: 5 additions & 5 deletions scripts/_utils.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export WORKSPACE_DIR=`realpath $(dirname $0)/..`
export WORKSPACE_DIR=$(realpath $(dirname $0)/..)
export WORKSPACE_BUILD_DIR="${WORKSPACE_DIR}/build"

function log() {
caller=`basename "$0"`
caller=$(basename "$0")
echo "[${caller%.*}]: $@"
}

function check-cmd() {
for cmd_name in "$@"; do
if ! command -v ${cmd_name} > /dev/null; then
log "Missing required command dependency: $1"
if ! command -v ${cmd_name} >/dev/null; then
log "Missing required command dependency: $cmd_name"
exit -1
fi
done
Expand All @@ -26,7 +26,7 @@ function check-env() {

function workdir() {
mkdir -p "$1"
pushd "$1" > /dev/null
pushd "$1" >/dev/null
}

if [ "${NOTION_REPACKAGED_DEBUG}" = true ]; then
Expand Down
12 changes: 8 additions & 4 deletions scripts/build-locally.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

source `dirname $0`/_utils.sh
source $(dirname $0)/_utils.sh
workdir ${WORKSPACE_BUILD_DIR}

check-cmd jq git
Expand All @@ -26,7 +26,7 @@ if [ ! -d "${NOTION_REPACKAGED_EDITION_SRCDIR}" ]; then
exit -1
fi

pushd "${NOTION_REPACKAGED_EDITION_SRCDIR}" > /dev/null
pushd "${NOTION_REPACKAGED_EDITION_SRCDIR}" >/dev/null

log "Installing dependencies..."
npm install
Expand All @@ -35,10 +35,14 @@ log "Running patch-package"
npx patch-package

log "Install electron and electron-builder..."
npm install electron@11 electron-builder --save-dev
npm install electron@33.1.0 electron-builder electron-rebuild --save-dev

log "Rebuilding native modules..."
npx electron-rebuild -f -w better-sqlite3

# Hint: Prefix the command with `DEBUG=electron-builder` to enable debug mode
log "Running electron-builder..."
node_modules/.bin/electron-builder \
--config $WORKSPACE_DIR/electron-builder.js $@

popd > /dev/null
popd >/dev/null
Loading