Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions notion/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# for jckleiner/notion-backup
# NOTION_SPACE_ID=''
# NOTION_TOKEN=''
# NOTION_FILE_TOKEN=''

# for ivanik/notion-backup
EMAIL=""
PASSWORD=""
EXPORT_TYPE="both" # markdown/html/both
48 changes: 48 additions & 0 deletions notion/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

# Backup notes from a Notion workspace

set -e # this script will exit if any command returns a non-null value

echo "Cloning Notion backup script ..."
# rm -rf notion-backup || true
# git clone https://github.com/darobin/notion-backup.git
# rm -rf notion-backup || true
# git clone https://github.com/ivanik/notion-backup.git

# echo "Deleting previous backup ..."
# rm -rf markdown html *.zip

source ./.env # loads NOTION_SPACE_ID, NOTION_TOKEN and NOTION_FILE_TOKEN
echo "Archiving Notion workspace ${NOTION_SPACE_ID} ..."
mkdir last_backup_data || true
cd last_backup_data
# NODE_VERSION=18 \
# NODE_OPTIONS="--max-http-header-size 15000" \
# NOTION_TOKEN=${NOTION_TOKEN} \
# NOTION_SPACE_ID=${NOTION_SPACE_ID} \
# NOTION_FILE_TOKEN=${NOTION_FILE_TOKEN} \
# ~/.nvm/nvm-exec \
# npx --yes notion-backup

# docker run \
# --rm=true \
# --env-file=../.env \
# ghcr.io/jckleiner/notion-backup

# docker run \
# --rm=true \
# --env-file=../.env \
# ivanik/notion-backup

NODE_VERSION=18 \
NODE_OPTIONS="--max-http-header-size 15000" \
EMAIL=${EMAIL} \
PASSWORD=${PASSWORD} \
EXPORT_TYPE=${EXPORT_TYPE} \
~/.nvm/nvm-exec \
npx --yes github:adrienjoly/notion-backup
# npx --yes run-url https://raw.githubusercontent.com/ivanik7/notion-backup/master/notion.js

echo "✅ Done."
# echo "ℹ️ Next steps: run ./zip-and-upload.sh && ./clean-up.sh"