Skip to content

Commit 108b017

Browse files
committed
Externalize script settings and workflow improvements
1 parent 723195a commit 108b017

File tree

7 files changed

+116
-37
lines changed

7 files changed

+116
-37
lines changed

.github/release-drafter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
template: |
2+
## Changes
3+
4+
$CHANGES

.github/workflows/main.yml renamed to .github/workflows/notion-repackaged.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
name: Notion Repackage
1+
name: Notion Repackaged Main
22

33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- 'notion-repackaged.env'
68

79
workflow_dispatch:
810
inputs: {}
911

1012
env:
11-
NOTION_VERSION: 2.0.16
12-
NOTION_DOWNLOAD_HASH: 9f72284086cda3977f7f569dff3974d5
13-
NOTION_ENHANCER_COMMIT: b248ffa3bac393f267a4600d4e951aba8565f31e
14-
NOTION_REPACKAGED_REVISION: 1
1513
NOTION_REPACKAGED_DEBUG: true
1614

1715
jobs:
16+
create-release:
17+
name: Create release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- run: grep -v '^#' notion-repackaged.env >> $GITHUB_ENV
22+
- uses: release-drafter/release-drafter@v5
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
version: "${{ env.NOTION_VERSION }}-${{ env.NOTION_REPACKAGED_REVISION }}"
27+
1828
make-vanilla-sources:
1929
name: Make vanilla sources
2030
runs-on: ubuntu-latest
2131
steps:
2232
- uses: actions/checkout@v2
33+
- run: grep -v '^#' notion-repackaged.env >> $GITHUB_ENV
2334
- name: Download official Windows build
2435
run: scripts/download-exe.sh
2536
- name: Extract sources from Windows Build
@@ -39,6 +50,7 @@ jobs:
3950
runs-on: ubuntu-latest
4051
steps:
4152
- uses: actions/checkout@v2
53+
- run: grep -v '^#' notion-repackaged.env >> $GITHUB_ENV
4254
- name: Retrieve saved vanilla sources
4355
uses: actions/download-artifact@v2
4456
with:
@@ -62,7 +74,7 @@ jobs:
6274

6375
build-app:
6476
name: Build app
65-
needs: [make-vanilla-sources, make-enhanced-sources]
77+
needs: [make-vanilla-sources, make-enhanced-sources, create-release]
6678
runs-on: ${{ matrix.os }}
6779
strategy:
6880
matrix:
@@ -82,6 +94,7 @@ jobs:
8294
edition: vanilla
8395
steps:
8496
- uses: actions/checkout@v2
97+
- run: grep -v '^#' notion-repackaged.env >> $GITHUB_ENV
8598
- uses: actions/setup-node@v1
8699
with:
87100
node-version: 14
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Potential Duplicates
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: bubkoo/potential-duplicates@v1
12+
with:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
filter: ''
15+
exclude: ''
16+
label: potential-duplicate
17+
state: all
18+
threshold: 0.6
19+
reactions: 'eyes, confused'
20+
comment: >
21+
Potential duplicates: {{#issues}}
22+
- [#{{ number }}] {{ title }} ({{ accuracy }}%)
23+
{{/issues}}

.github/workflows/stale-issues.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close inactive issues
2+
3+
on:
4+
schedule:
5+
- cron: "30 1 * * *"
6+
7+
jobs:
8+
close-issues:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/stale@v3
12+
with:
13+
days-before-issue-stale: 45
14+
days-before-issue-close: 14
15+
stale-issue-label: "stale"
16+
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
17+
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
18+
days-before-pr-stale: -1
19+
days-before-pr-close: -1
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}

notion-repackaged.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NOTION_VERSION=2.0.16
2+
NOTION_REPACKAGED_REVISION=2
3+
NOTION_DOWNLOAD_HASH=9f72284086cda3977f7f569dff3974d5
4+
NOTION_ENHANCER_COMMIT=b248ffa3bac393f267a4600d4e951aba8565f31e

scripts/_utils.sh

100755100644
Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
set -a
2-
3-
WORKSPACE_DIR=`realpath $(dirname $0)/..`
4-
5-
NOTION_VERSION="${NOTION_VERSION:-2.0.16}"
6-
NOTION_DOWNLOAD_HASH="${NOTION_DOWNLOAD_HASH:-9f72284086cda3977f7f569dff3974d5}"
7-
NOTION_DOWNLOAD_URL="https://desktop-release.notion-static.com/Notion%20Setup%20${NOTION_VERSION}.exe"
8-
NOTION_DOWNLOADED_NAME="Notion-${NOTION_VERSION}.exe"
9-
10-
NOTION_ENHANCER_COMMIT="${NOTION_ENHANCER_COMMIT:-b248ffa3bac393f267a4600d4e951aba8565f31e}"
11-
NOTION_ENHANCER_REPO_URL="https://github.com/notion-enhancer/notion-enhancer"
12-
13-
NOTION_EXTRACTED_EXE_NAME="extracted-exe"
14-
NOTION_EXTRACTED_APP_NAME="extracted-app"
15-
NOTION_VANILLA_SRC_NAME="vanilla-src"
16-
NOTION_ENHANCED_SRC_NAME="enhanced-src"
17-
NOTION_EMBEDDED_NAME="embedded_enhancer"
18-
19-
NOTION_REPACKAGED_REVISION="${NOTION_REPACKAGED_REVISION:-1}"
20-
NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}"
21-
NOTION_REPACKAGED_HOMEPAGE="https://github.com/jamezrin/notion-repackaged"
22-
NOTION_REPACKAGED_REPO=${NOTION_REPACKAGED_REPO:-${NOTION_REPACKAGED_HOMEPAGE}}
23-
NOTION_REPACKAGED_AUTHOR="Notion Repackaged"
24-
25-
set +a
1+
export WORKSPACE_DIR=`realpath $(dirname $0)/..`
262

273
function log() {
284
caller=`basename "$0"`
@@ -36,6 +12,15 @@ function check-cmd() {
3612
fi
3713
}
3814

15+
function check-env() {
16+
for var_name in "$@"; do
17+
if [ -z "${!var_name}" ]; then
18+
log "Required environment variable $var_name is not set"
19+
exit -1
20+
fi
21+
done
22+
}
23+
3924
function workspace-dir-pushd() {
4025
mkdir -p "${WORKSPACE_DIR}/build"
4126
pushd "${WORKSPACE_DIR}/build" > /dev/null
@@ -46,3 +31,21 @@ function check-debug-expands() {
4631
set -x
4732
fi
4833
}
34+
35+
check-env NOTION_VERSION NOTION_REPACKAGED_REVISION NOTION_DOWNLOAD_HASH NOTION_ENHANCER_COMMIT
36+
37+
export NOTION_DOWNLOAD_URL="https://desktop-release.notion-static.com/Notion%20Setup%20${NOTION_VERSION}.exe"
38+
export NOTION_DOWNLOADED_NAME="Notion-${NOTION_VERSION}.exe"
39+
40+
41+
export NOTION_ENHANCER_REPO_URL="https://github.com/notion-enhancer/notion-enhancer"
42+
export NOTION_EXTRACTED_EXE_NAME="extracted-exe"
43+
export NOTION_EXTRACTED_APP_NAME="extracted-app"
44+
export NOTION_VANILLA_SRC_NAME="vanilla-src"
45+
export NOTION_ENHANCED_SRC_NAME="enhanced-src"
46+
export NOTION_EMBEDDED_NAME="embedded_enhancer"
47+
48+
export NOTION_REPACKAGED_VERSION_REV="${NOTION_VERSION}-${NOTION_REPACKAGED_REVISION}"
49+
export NOTION_REPACKAGED_HOMEPAGE="https://github.com/jamezrin/notion-repackaged"
50+
export NOTION_REPACKAGED_REPO=${NOTION_REPACKAGED_REPO:-${NOTION_REPACKAGED_HOMEPAGE}}
51+
export NOTION_REPACKAGED_AUTHOR="Notion Repackaged"

scripts/build-locally.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@ workspace-dir-pushd
88
check-cmd jq
99
check-cmd git
1010

11-
if [ ! -d "${NOTION_ENHANCED_SRC_NAME}" ]; then
12-
log "Sources do not seem to have been made..."
13-
exit 1
11+
if [ -z "${NOTION_REPACKAGED_EDITION}" ]; then
12+
log "Cannot build without knowing the edition to build, please set NOTION_REPACKAGED_EDITION env var"
13+
exit -1
1414
fi
1515

16-
pushd "${NOTION_ENHANCED_SRC_NAME}" > /dev/null
16+
if [ "${NOTION_REPACKAGED_EDITION}" == "enhanced" ]; then
17+
NOTION_REPACKAGED_EDITION_SRCDIR="${NOTION_ENHANCED_SRC_NAME}"
18+
elif [ "${NOTION_REPACKAGED_EDITION}" == "vanilla" ]; then
19+
NOTION_REPACKAGED_EDITION_SRCDIR="${NOTION_VANILLA_SRC_NAME}"
20+
else
21+
log "Invalid value for the NOTION_REPACKAGED_EDITION env var, it has to either be 'vanilla' or 'enhanced'"
22+
exit -1
23+
fi
24+
25+
if [ ! -d "${NOTION_REPACKAGED_EDITION_SRCDIR}" ]; then
26+
log "Could not find the directory for this edition's sources, please build them first"
27+
exit -1
28+
fi
29+
30+
pushd "${NOTION_REPACKAGED_EDITION_SRCDIR}" > /dev/null
1731

1832
log "Installing dependencies..."
1933
npm install
2034

2135
log "Install electron and electron-builder..."
2236
npm install electron@11 electron-builder --save-dev
2337

24-
export NOTION_REPACKAGED_EDITION=enhanced
25-
2638
log "Running electron-builder..."
2739
node_modules/.bin/electron-builder \
2840
--config $WORKSPACE_DIR/electron-builder.js $@

0 commit comments

Comments
 (0)