Skip to content

Commit 5ea6263

Browse files
authored
Build: Update the deploy script and config file encryption (#3195)
* add --legacy-peer-deps flag in deploy script * update options in circleCI config * maybe we do need force * add encrypt/decrypt conf to Makefile, update README instructions, re-encrypt config with up-to-date encryption method, upgrade packages in vip/package.json * update decryption on circleCI * punctuation * error message if an invalid deploy target is specified
1 parent 0bff9da commit 5ea6263

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ references:
1010
command: |
1111
openssl aes-256-cbc -md md5 -d -in ./resources/certificates/win.p12.enc -out ./resources/certificates/win.p12 -k ${SECRETS_ENCRYPTION_KEY_2024}
1212
openssl aes-256-cbc -md md5 -d -in ./resources/certificates/mac.p12.enc -out ./resources/certificates/mac.p12 -k ${SECRETS_ENCRYPTION_KEY}
13-
openssl aes-256-cbc -md md5 -d -in ./resources/secrets/config.json.enc -out ./config.json -k ${SECRETS_ENCRYPTION_KEY}
13+
openssl aes-256-cbc -d -in ./resources/secrets/config.json.enc -out ./config.json -pbkdf2 -k ${SECRETS_ENCRYPTION_KEY}
1414
job_filters: &job_filters
1515
branches:
1616
ignore:

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,21 @@ lint-scss:
173173
.PHONY: lint-js
174174
lint-js:
175175
@npx eslint --ignore-path .gitignore "**/*.{js,jsx,ts,tsx}"
176+
177+
178+
# encrypted config file
179+
.PHONY: _pwd_prompt decrypt_conf encrypt_conf
180+
181+
CONF_FILE=./resources/secrets/config.json.enc
182+
183+
# 'private' task for echoing instructions
184+
_pwd_prompt:
185+
@echo "Check the secret store for Simplenote!"
186+
187+
# to create config
188+
decrypt_conf: _pwd_prompt
189+
openssl aes-256-cbc -d -in ${CONF_FILE} -out ./config-local.json -pbkdf2
190+
191+
# for updating config
192+
encrypt_conf: _pwd_prompt
193+
openssl aes-256-cbc -e -in config-local.json -out ${CONF_FILE} -pbkdf2

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ A Simplenote [React](https://reactjs.org/) client packaged in [Electron](https:/
66

77
## Running
88

9+
**Read this first!!** Local development is currently not supported if you don't have an existing account on the test server or access to the production credentials. This is because the move to an email-first signup flow has made it impossible to create accounts in the test database. We hope to be able to support an open-source development workflow again in the future.
10+
911
1. Clone the repo: `git clone https://github.com/Automattic/simplenote-electron.git`
1012
2. `cd simplenote-electron`
1113
3. `npm install --legacy-peer-deps` (This flag is necessary because `react-monaco-editor` is pinned to a specific `monaco-editor` dependency, but `npm` [considers minor versions to be breaking changes for sub-1.0.0 apps](https://stackoverflow.com/questions/62629878/why-doesnt-npm-upgrade-install-my-0-0-1-dep-with-a-dependency-on-0-0-0))
12-
4. `npm run dev`
13-
5. The dev server will start on [http://localhost:4000](http://localhost:4000), and the Electron app will launch automatically.
14-
6. For all logging from Electron to be printed to the terminal (e.g. `console.log` statements within `app.js`), you might need to set `env ELECTRON_ENABLE_LOGGING=1`.
15-
7. Sign up for a new account within the app. Use the account for **testing purposes only** as all note data will be periodically cleared out on the server.
14+
4. Decrypt the config file using `make decrypt_conf`.
15+
5. `npm run dev`
16+
6. The dev server will start on [http://localhost:4000](http://localhost:4000), and the Electron app will launch automatically.
17+
7. For all logging from Electron to be printed to the terminal (e.g. `console.log` statements within `app.js`), you might need to set `env ELECTRON_ENABLE_LOGGING=1`.
1618

17-
_Note: Simplenote API features such as sharing and publishing will not work with development builds. Due to a limitation of `make` installation paths used for build cannot have spaces._
19+
_Note: Simplenote API features such as sharing and publishing will not work with development builds. Due to a limitation of `make`, installation paths used for build cannot have spaces._
1820

1921
## Building
2022

bin/deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ case $1 in
3131
;;
3232

3333
*)
34+
echo "Deploy environment must be one of: production, develop, staging"
3435
exit 0
3536
;;
3637
esac
3738

3839
# Install Node Modules
39-
npm install
40+
npm install --legacy-peer-deps
4041

4142
# Temporarily move config-local so it doesn't get overwritten
4243
mv config-local.json config-local.original.json
@@ -81,4 +82,4 @@ echo "Deployed Successfully!"
8182

8283
git checkout trunk
8384

84-
exit 0
85+
exit 0

resources/secrets/config.json.enc

0 Bytes
Binary file not shown.

vip/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"url": "git://github.com/Automattic/simplenote-electron.git"
1313
},
1414
"dependencies": {
15-
"@automattic/vip-go": "0.3.3",
16-
"express": "4.17.1"
15+
"@automattic/vip-go": "1.1.0",
16+
"express": "4.19.2"
1717
}
1818
}

0 commit comments

Comments
 (0)