From ef18cb4144c11c32dc9716a0d8318b377be88fff Mon Sep 17 00:00:00 2001 From: dbxnr Date: Thu, 9 Jan 2020 18:20:48 +0000 Subject: [PATCH 01/15] Fix for unhandled exception --- jrnl/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/util.py b/jrnl/util.py index 5918b14b..dfe0d13e 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -103,7 +103,7 @@ def set_keychain(journal_name, password): if password is None: try: keyring.delete_password("jrnl", journal_name) - except RuntimeError: + except keyring.errors.PasswordDeleteError: pass else: keyring.set_password("jrnl", journal_name, password) From 41c4c241cc9f3cb6a00094dd3dd234c602ca0142 Mon Sep 17 00:00:00 2001 From: Micah Ellison <4383304+micahellison@users.noreply.github.com> Date: Thu, 9 Jan 2020 20:34:38 -0800 Subject: [PATCH 02/15] #790 - closing temp file before passing it to editor to prevent file locking issues in Windows --- jrnl/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jrnl/util.py b/jrnl/util.py index 5918b14b..7af8d6c4 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -142,21 +142,26 @@ def scope_config(config, journal_name): def get_text_from_editor(config, template=""): filehandle, tmpfile = tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt") + os.close(filehandle) + with open(tmpfile, "w", encoding="utf-8") as f: if template: f.write(template) + try: subprocess.call( shlex.split(config["editor"], posix="win" not in sys.platform) + [tmpfile] ) except AttributeError: subprocess.call(config["editor"] + [tmpfile]) + with open(tmpfile, "r", encoding="utf-8") as f: raw = f.read() - os.close(filehandle) os.remove(tmpfile) + if not raw: print("[Nothing saved to file]", file=sys.stderr) + return raw From 59d865134afb414361136184b2fb3129ed4302ea Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 11 Jan 2020 21:20:14 -0800 Subject: [PATCH 03/15] Update changelog in prep for auto changelog generator (#724) Getting ready to implement the auto-changelog generator is easier if we are caught up with the old changes. This was generated by running the generator locally. Co-authored-by: Micah Jerome Ellison --- CHANGELOG.md | 156 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81c93758..214d5efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,127 @@ -Changelog -========= +# Changelog -## 2.0 +## Unreleased -* Cryptographic backend changed from PyCrypto to cryptography.io -* Config now respects XDG conventions and may move accordingly -* Config now saved as YAML -* Config name changed from `journals.jrnl_name.journal` to `journals.jrnl_name.path` +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.1.1...HEAD) -### 1.9 (July 21, 2014) +**Implemented enhancements:** + +- Full text search \(case insensitive\) with "-contains" [\#740](https://github.com/jrnl-org/jrnl/pull/740) ([empireshades](https://github.com/empireshades)) +- Reduce startup time by 55% [\#719](https://github.com/jrnl-org/jrnl/pull/719) ([maebert](https://github.com/maebert)) +- Refactor password logic to prevent accidental password leakage [\#708](https://github.com/jrnl-org/jrnl/pull/708) ([pspeter](https://github.com/pspeter)) +- Password confirmation [\#706](https://github.com/jrnl-org/jrnl/pull/706) ([pspeter](https://github.com/pspeter)) + +**Build:** + +- Update Black version and lock file to fix builds on develop branch [\#784](https://github.com/jrnl-org/jrnl/pull/784) ([wren](https://github.com/wren)) +- Run black formatter on codebase for standardization [\#778](https://github.com/jrnl-org/jrnl/pull/778) ([wren](https://github.com/wren)) +- Skip Broken Windows Tests [\#772](https://github.com/jrnl-org/jrnl/pull/772) ([wren](https://github.com/wren)) +- Black Formatter [\#769](https://github.com/jrnl-org/jrnl/pull/769) ([MinchinWeb](https://github.com/MinchinWeb)) +- Update lock file and testing suite for Python 3.8 [\#765](https://github.com/jrnl-org/jrnl/pull/765) ([wren](https://github.com/wren)) +- Fix CI config to only deploy once [\#761](https://github.com/jrnl-org/jrnl/pull/761) ([wren](https://github.com/wren)) +- More Travis-CI Testing [\#759](https://github.com/jrnl-org/jrnl/pull/759) ([MinchinWeb](https://github.com/MinchinWeb)) + +**Updated documentation:** + +- Remove merge marker in recipes.md [\#782](https://github.com/jrnl-org/jrnl/pull/782) ([markphelps](https://github.com/markphelps)) +- Fix merge conflict left-over [\#767](https://github.com/jrnl-org/jrnl/pull/767) ([thejspr](https://github.com/thejspr)) +- Display header in docs on mobile devices [\#763](https://github.com/jrnl-org/jrnl/pull/763) ([maebert](https://github.com/maebert)) + +## [v2.1.1](https://pypi.org/project/jrnl/v2.1.1/) (2019-11-26) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.1.1-beta...v2.1.1) + +**Implemented enhancements:** + +- Support Python 3.6+ [\#710](https://github.com/jrnl-org/jrnl/pull/710) ([pspeter](https://github.com/pspeter)) +- Drop Python 2 support, add mocks in tests [\#705](https://github.com/jrnl-org/jrnl/pull/705) ([pspeter](https://github.com/pspeter)) + +**Fixed bugs:** + +- Prevent readline usage on Windows, which was causing Active Python crashes on install [\#751](https://github.com/jrnl-org/jrnl/pull/751) ([micahellison](https://github.com/micahellison)) +- Exit jrnl if no text entered into editor [\#744](https://github.com/jrnl-org/jrnl/pull/744) ([alichtman](https://github.com/alichtman)) +- Fix crash when no keyring backend available [\#699](https://github.com/jrnl-org/jrnl/pull/699) ([pspeter](https://github.com/pspeter)) +- Fix parsing Journals using a little-endian date format [\#694](https://github.com/jrnl-org/jrnl/pull/694) ([pspeter](https://github.com/pspeter)) + +**Updated documentation:** + +- Update developer documentation [\#752](https://github.com/jrnl-org/jrnl/pull/752) ([micahellison](https://github.com/micahellison)) +- Create templates for issues and pull requests [\#679](https://github.com/jrnl-org/jrnl/pull/679) ([C0DK](https://github.com/C0DK)) +- Smaller doc fixes [\#649](https://github.com/jrnl-org/jrnl/pull/649) ([maebert](https://github.com/maebert)) +- Move to mkdocs [\#611](https://github.com/jrnl-org/jrnl/pull/611) ([maebert](https://github.com/maebert)) + +## [v2.1.post2](https://pypi.org/project/jrnl/v2.1.post2/) (2019-11-11) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.1-beta6...v2.1.post2) + +**Fixed bugs:** + +- Expand paths that use ~ to full path [\#704](https://github.com/jrnl-org/jrnl/pull/704) ([MinchinWeb](https://github.com/MinchinWeb)) + +**Build:** + +- Separate local dev from pipeline releases [\#684](https://github.com/jrnl-org/jrnl/pull/684) ([wren](https://github.com/wren)) +- Update version handling in source and travis deployments [\#683](https://github.com/jrnl-org/jrnl/pull/683) ([wren](https://github.com/wren)) +- Use Poetry for dependency management and deployments [\#612](https://github.com/jrnl-org/jrnl/pull/612) ([maebert](https://github.com/maebert)) + +**Updated documentation:** + +- Fix typos, spelling [\#734](https://github.com/jrnl-org/jrnl/pull/734) ([MinchinWeb](https://github.com/MinchinWeb)) + +## [v2.0.1](https://pypi.org/project/jrnl/v2.0.1/) (2019-09-26) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.0.1-beta...v2.0.1) + +**Implemented enhancements:** + +- Switch to hashmark Markdown headers on export \(Mk II\) [\#639](https://github.com/jrnl-org/jrnl/pull/639) ([MinchinWeb](https://github.com/MinchinWeb)) +- Add '-not' flag for excluding tags from filter [\#637](https://github.com/jrnl-org/jrnl/pull/637) ([jprof](https://github.com/jprof)) +- Handle KeyboardInterrupt when installing journal [\#550](https://github.com/jrnl-org/jrnl/pull/550) ([silenc3r](https://github.com/silenc3r)) + +**Fixed bugs:** + +- Change pyYAML required version [\#660](https://github.com/jrnl-org/jrnl/pull/660) ([etnnth](https://github.com/etnnth)) + +**Updated documentation:** + +- Fix references to Sphinx in CONTRIBUTING.md [\#655](https://github.com/jrnl-org/jrnl/pull/655) ([maebert](https://github.com/maebert)) + +## [v2.0.0](https://pypi.org/project/jrnl/v2.0.0/) (2019-08-24) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.0-rc4...v2.0.0) + +**Implemented enhancements:** +- Change cryptographic backend from PyCrypto to cryptography.io +- Config now respects XDG conventions and may move accordingly +- Config name changed from `journals.jrnl_name.journal` to `journals.jrnl_name.path` + +**Fixed bugs:** + +- Confirm that each journal can be parsed during upgrade, and abort upgrade if not [\#650](https://github.com/jrnl-org/jrnl/pull/650) ([micahellison](https://github.com/micahellison)) +- Escape dates in square brackets [\#644](https://github.com/jrnl-org/jrnl/pull/644) ([wren](https://github.com/wren)) +- Create encrypted journal [\#641](https://github.com/jrnl-org/jrnl/pull/641) ([gregorybodnar](https://github.com/gregorybodnar)) +- Resolve issues around unreadable dates to allow markdown footnotes and prevent accidental deletion [\#623](https://github.com/jrnl-org/jrnl/pull/623) ([micahellison](https://github.com/micahellison)) +- Update crypto module \#610 [\#621](https://github.com/jrnl-org/jrnl/pull/621) ([wren](https://github.com/wren)) +- Fix issue \#584 YAMLLoadWarning [\#585](https://github.com/jrnl-org/jrnl/pull/585) ([wren](https://github.com/wren)) + +**Deprecated:** + +- Deprecate Python 2 [\#624](https://github.com/jrnl-org/jrnl/pull/624) ([micahellison](https://github.com/micahellison)) +- Config now saved as YAML (no more JSON) + +**Build:** + +- change pinned label to a super cool emoji ⭐️ [\#646](https://github.com/jrnl-org/jrnl/pull/646) ([wren](https://github.com/wren)) +- Update Travis build badge and restore pypi badges [\#603](https://github.com/jrnl-org/jrnl/pull/603) ([micahellison](https://github.com/micahellison)) + +**Updated documentation:** + +- Mention lack of Day One support and relevant history in readme [\#608](https://github.com/jrnl-org/jrnl/pull/608) ([micahellison](https://github.com/micahellison)) +- Add a code of conduct file \(rather than adding to contributing\) [\#604](https://github.com/jrnl-org/jrnl/pull/604) ([wren](https://github.com/wren)) +- Update docs to reflect merging jrnl-plus fork back upstream [\#601](https://github.com/jrnl-org/jrnl/pull/601) ([micahellison](https://github.com/micahellison)) +- Add instructions for VS Code [\#544](https://github.com/jrnl-org/jrnl/pull/544) ([emceeaich](https://github.com/emceeaich)) + +## v1.9 (2014-07-21) * __1.9.5__ Multi-word tags for DayOne Journals * __1.9.4__ Fixed: Order of journal entries in file correct after --edit'ing @@ -17,7 +130,7 @@ Changelog * __1.9.1__ Fixed: Dates in the future can be parsed as well. * __1.9.0__ Improved: Greatly improved date parsing. Also added an `-on` option for filtering -### 1.8 (May 22, 2014) +## v1.8 (2014-05-22) * __1.8.7__ Fixed: -from and -to filters are inclusive (thanks to @grplyler) * __1.8.6__ Improved: Tags like @C++ and @OS/2 work, too (thanks to @chaitan94) @@ -28,7 +141,7 @@ Changelog * __1.8.1__ Minor bug fixes * __1.8.0__ Official support for python 3.4 -### 1.7 (December 22, 2013) +## v1.7 (2013-12-22) * __1.7.22__ Fixed an issue with writing files when exporting entries containing non-ascii characters. * __1.7.21__ jrnl now uses PKCS#7 padding. @@ -54,7 +167,7 @@ Changelog * __1.7.0__ Edit encrypted or DayOne journals with `jrnl --edit`. -### 1.6 (November 5, 2013) +## v1.6 (2013-11-05) * __1.6.6__ -v prints the current version, also better strings for windows users. Furthermore, jrnl/jrnl.py moved to jrnl/cli.py * __1.6.5__ Allows composing multi-line entries on the command line or importing files @@ -64,7 +177,7 @@ Changelog * __1.6.1__ Attempts to fix broken config files automatically * __1.6.0__ Passwords are now saved in the key-chain. The `password` field in `.jrnl_config` is soft-deprecated. -### 1.5 (August 6, 2013) +## v1.5 (2013-08-06) * __1.5.7__ The `~` in journal config paths will now expand properly to e.g. `/Users/maebert` * __1.5.6__ Fixed: Fixed a bug where on OS X, the timezone could only be accessed on administrator accounts. @@ -75,23 +188,23 @@ Changelog * __1.5.1__ Fixed: Fixed a bug introduced in 1.5.0 that caused the entire journal to be printed after composing an entry * __1.5.0__ Exporting, encrypting and displaying tags now takes your filter options into account. So you could export everything before May 2012: `jrnl -to 'may 2012' --export json`. Or encrypt all entries tagged with `@work` into a new journal: `jrnl @work --encrypt work_journal.txt`. Or display all tags of posts where Bob is also tagged: `jrnl @bob --tags` -### 1.4 (July 22, 2013) +## v1.4 (2013-07-22) * __1.4.2__ Fixed: Tagging works again * __1.4.0__ Unifies encryption between Python 2 and 3. If you have problems reading encrypted journals afterwards, first decrypt your journal with the __old__ jrnl version (install with `pip install jrnl==1.3.1`, then `jrnl --decrypt`), upgrade jrnl (`pip install jrnl --upgrade`) and encrypt it again (`jrnl --encrypt`). -### 1.3 (July 17, 2013) +## v1.3 (2013-07-17) * __1.3.2__ Everything that is not direct output of jrnl will be written stderr to improve integration * __1.3.0__ Export to multiple files * __1.3.0__ Feature to export to given output file -### 1.2 (July 15, 2013) +## v1.2 (2013-07-15) * __1.2.0__ Fixed: Timezone support for DayOne -### 1.1 (June 9, 2013) +## v1.1 (2013-06-09) * __1.1.1__ Fixed: Unicode and Python3 issues resolved. * __1.1.0__ @@ -99,7 +212,7 @@ Changelog * Nicer error message when there is a syntactical error in your config file. * Unicode support -### 1.0 (March 4, 2013) +## v1.0 (2013-03-04) * __1.0.5__ Backwards compatibility with `parsedatetime` 0.8.7 * __1.0.4__ @@ -122,7 +235,7 @@ Changelog * Fixed: A bug where jrnl would not add entries without timestamp * Fixed: Support for parsedatetime 1.x -### 0.3 (May 24, 2012) +## v0.3 (2012-05-24) * __0.3.2__ Converts `\n` to new lines (if using directly on a command line, make sure to wrap your entry with quotes). * __0.3.1__ @@ -135,7 +248,7 @@ Changelog * Fixed: Bug where composed entry is lost when the journal file fails to load * Changed directory structure and install scripts (removing the necessity to make an alias from `jrnl` to `jrnl.py`) -### 0.2 (April 16, 2012) +## v0.2 (2012-04-16) * __0.2.4__ * Fixed: Parsing of new lines in journal files and entries @@ -153,7 +266,7 @@ Changelog * Encrypts using CBC * Fixed: `key` has been renamed to `password` in config to avoid confusion. (The key use to encrypt and decrypt a journal is the SHA256-hash of the password.) -### 0.1 (April 13, 2012) +## v0.1 (2012-04-13) * __0.1.1__ @@ -166,6 +279,7 @@ Changelog * Filtering by tags and dates * Fixed: Now using dedicated classes for Journals and entries -### 0.0 (March 29, 2012) +## v0.0 (2012-03-29) * __0.0.1__ Composing entries works. That's pretty much it. + From 334c9b3e7a5cd6eb68a0545b3c1cd208226334d0 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Mon, 13 Jan 2020 20:09:28 -0800 Subject: [PATCH 04/15] add config file for changelog generator --- .github_changelog_generator | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github_changelog_generator diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 00000000..38349f58 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,9 @@ +project=jrnl +user=jrnl-org +base=CHANGELOG.md +issues=false +issues-wo-labels=false +include-labels=bug,enhancement,documentation,build,deprecated +release-url='https://pypi.org/project/jrnl/%s/' +add-sections={ "build": { "prefix": "**Build:**", "labels": ["build"]}, "docs": { "prefix": "**Updated documentation:**", "labels": ["documentation"]}} +exclude-tags-regex=(alpha|beta|rc) From f564c8ca347de88d273373213b38b677e427e671 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Mon, 13 Jan 2020 20:45:56 -0800 Subject: [PATCH 05/15] use api token instead of username and pw for pypi --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e493c534..b3903997 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,7 +117,7 @@ jobs: - stage: Deploy if: branch = master AND tag IS present before_deploy: - - poetry config http-basic.pypi "$PYPI_USER" "$PYPI_PASS" + - poetry config pypi-token.pypi "$PYPI_TOKEN" - poetry version "$TRAVIS_TAG" - echo __version__ = \"$TRAVIS_TAG\" > jrnl/__version__.py - poetry build From 8ecc2baa9c55ceb03ebe41d37fc81595a56cc79c Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Mon, 13 Jan 2020 20:47:55 -0800 Subject: [PATCH 06/15] update changelog generator settings to be less verbose, fix links --- .github_changelog_generator | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github_changelog_generator b/.github_changelog_generator index 38349f58..983e4119 100644 --- a/.github_changelog_generator +++ b/.github_changelog_generator @@ -4,6 +4,8 @@ base=CHANGELOG.md issues=false issues-wo-labels=false include-labels=bug,enhancement,documentation,build,deprecated -release-url='https://pypi.org/project/jrnl/%s/' +release-url=https://pypi.org/project/jrnl/%s/ add-sections={ "build": { "prefix": "**Build:**", "labels": ["build"]}, "docs": { "prefix": "**Updated documentation:**", "labels": ["documentation"]}} exclude-tags-regex=(alpha|beta|rc) +verbose=false + From 7fba6c77a454af767f4a80475001e26b4785610e Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Tue, 14 Jan 2020 19:44:26 -0800 Subject: [PATCH 07/15] fix conditional for deploy step --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b3903997..ba6ead9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,7 +115,6 @@ jobs: - TZ=America/Edmonton - stage: Deploy - if: branch = master AND tag IS present before_deploy: - poetry config pypi-token.pypi "$PYPI_TOKEN" - poetry version "$TRAVIS_TAG" @@ -124,6 +123,10 @@ jobs: deploy: - provider: script script: poetry publish + skip_cleanup: true + on: + branch: master + tags: true after_deploy: - git config --global user.email "jrnl.bot@gmail.com" - git config --global user.name "Jrnl Bot" From 778a37cd5ef56cb67d8985e2dbeec49f6d681cd1 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Tue, 14 Jan 2020 20:06:14 -0800 Subject: [PATCH 08/15] add script to generate changelog --- .build/generate_changelog.sh | 40 ++++++++++++++++++++++++++++++++++++ .travis.yml | 8 ++++++++ 2 files changed, 48 insertions(+) create mode 100755 .build/generate_changelog.sh diff --git a/.build/generate_changelog.sh b/.build/generate_changelog.sh new file mode 100755 index 00000000..b0267422 --- /dev/null +++ b/.build/generate_changelog.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +FILENAME='CHANGELOG.md' + +# get the latest git tags +gittags="$(git tag --sort=-creatordate | grep -Ev '(alpha|beta|rc)')" +gittag_latest=$(printf '%s' "$gittags" | awk 'NR==1') +gittag_secondlatest=$(printf '%s' "$gittags" | awk 'NR==2') + +echo "gittag_latest: ${gittag_latest}" +echo "gittag_secondlatest: ${gittag_secondlatest}" + +# delete generated line (or it will be added multiple times) +sed -i '/This Changelog was automatically generated by/d' "$FILENAME" + +# delete trailing empty lines +sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' "$FILENAME" + +# determine correct tag to go back to +# @TODO +if [[ ! -z $TRAVIS_TAG ]]; then + echo "release build" + gittag=${gittag_secondlatest} +else + echo "merge into master or develop" + gittag=${gittag_latest} +fi +echo "gittag: ${gittag}" + +# find the line the tag starts on, and subtract 1 +tagline=$(grep -n "^## \[\?$gittag\]\?" CHANGELOG.md | awk '{print $1}' FS=':' | head -1) +echo "tagline: ${tagline}" +[[ ! -z $tagline ]] && sed -i "1,$(expr $tagline - 1)d" "$FILENAME" + +# generate the changelog +docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator -t $CHANGELOG_GITHUB_TOKEN --since-tag $gittag + +# @TODO commit changes, etc +git diff + diff --git a/.travis.yml b/.travis.yml index ba6ead9a..a2d71c48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,6 +114,14 @@ jobs: env: - TZ=America/Edmonton + # Changelog for Unreleased changes + - stage: Update Changelog + if: (tag IS present) OR (branch = develop AND type NOT IN (pull_request)) + install: + - echo 'Skipping install' + script: + - ./.build/generate_changelog.sh + - stage: Deploy before_deploy: - poetry config pypi-token.pypi "$PYPI_TOKEN" From 4d70c46b6380c472fdf2351e9bbe0e4bcb23d955 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Tue, 14 Jan 2020 21:31:04 -0800 Subject: [PATCH 09/15] update changelog script to handle different scenarios (#724) --- .build/generate_changelog.sh | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/.build/generate_changelog.sh b/.build/generate_changelog.sh index b0267422..58867c20 100755 --- a/.build/generate_changelog.sh +++ b/.build/generate_changelog.sh @@ -3,12 +3,12 @@ FILENAME='CHANGELOG.md' # get the latest git tags -gittags="$(git tag --sort=-creatordate | grep -Ev '(alpha|beta|rc)')" -gittag_latest=$(printf '%s' "$gittags" | awk 'NR==1') -gittag_secondlatest=$(printf '%s' "$gittags" | awk 'NR==2') +releases="$(git tag --sort=-creatordate | grep -Ev '(alpha|beta|rc)')" +release_latest=$(printf '%s' "$releases" | awk 'NR==1') +release_secondlatest=$(printf '%s' "$releases" | awk 'NR==2') -echo "gittag_latest: ${gittag_latest}" -echo "gittag_secondlatest: ${gittag_secondlatest}" +echo "release_latest: ${release_latest}" +echo "release_secondlatest: ${release_secondlatest}" # delete generated line (or it will be added multiple times) sed -i '/This Changelog was automatically generated by/d' "$FILENAME" @@ -17,24 +17,38 @@ sed -i '/This Changelog was automatically generated by/d' "$FILENAME" sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' "$FILENAME" # determine correct tag to go back to -# @TODO -if [[ ! -z $TRAVIS_TAG ]]; then +if [[ $TRAVIS_TAG == $release_latest ]]; then echo "release build" - gittag=${gittag_secondlatest} + gittag=${release_secondlatest} +elif [[ ! -z $TRAVIS_TAG ]]; then + echo "beta elease" + gittag=${release_latest} else echo "merge into master or develop" - gittag=${gittag_latest} + gittag=${release_latest} fi echo "gittag: ${gittag}" # find the line the tag starts on, and subtract 1 -tagline=$(grep -n "^## \[\?$gittag\]\?" CHANGELOG.md | awk '{print $1}' FS=':' | head -1) +tagline=$(grep -n "^## \[\?$gittag\]\?" "$FILENAME" | awk '{print $1}' FS=':' | head -1) echo "tagline: ${tagline}" [[ ! -z $tagline ]] && sed -i "1,$(expr $tagline - 1)d" "$FILENAME" # generate the changelog -docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator -t $CHANGELOG_GITHUB_TOKEN --since-tag $gittag +docker run -it --rm -v "$(pwd)":/usr/local/src/your-app ferrarimarco/github-changelog-generator -t $GITHUB_TOKEN --since-tag $gittag -# @TODO commit changes, etc -git diff +# Put back our link (instead of the broken one) +sed -i 's!https://pypi.org/project/jrnl/HEAD/!https://github.com/jrnl-org/jrnl/!' "$FILENAME" + +BRANCH=$TRAVIS_BRANCH +if [[ $TRAVIS_BRANCH == $TRAVIS_TAG ]]; then + BRANCH='master' +fi + +git config --global user.email "jrnl.bot@gmail.com" +git config --global user.name "Jrnl Bot" +git checkout $BRANCH +git add "$FILENAME" +git commit -m "Updating changelog [ci skip]" +git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git $BRANCH From 4977924977451aa3beeeb8fcdea6f0a06efaf5a9 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Tue, 14 Jan 2020 21:36:58 -0800 Subject: [PATCH 10/15] update deploy stage condition --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a2d71c48..0fd39b6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -123,6 +123,7 @@ jobs: - ./.build/generate_changelog.sh - stage: Deploy + if: tag IS present before_deploy: - poetry config pypi-token.pypi "$PYPI_TOKEN" - poetry version "$TRAVIS_TAG" From af970cd47f7e370cb4c228120739eb5b22defd4b Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Tue, 14 Jan 2020 21:48:42 -0800 Subject: [PATCH 11/15] small fixes for travis pipeline --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0fd39b6e..37dab626 100644 --- a/.travis.yml +++ b/.travis.yml @@ -125,7 +125,6 @@ jobs: - stage: Deploy if: tag IS present before_deploy: - - poetry config pypi-token.pypi "$PYPI_TOKEN" - poetry version "$TRAVIS_TAG" - echo __version__ = \"$TRAVIS_TAG\" > jrnl/__version__.py - poetry build @@ -141,5 +140,5 @@ jobs: - git config --global user.name "Jrnl Bot" - git checkout master - git add pyproject.toml - - git commit -m "Incrementing version to ${TRAVIS_TAG}" + - git commit -m "Incrementing version to ${TRAVIS_TAG} [ci skip]" - git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git master From 43ff998ca3fe084d2b13ebbe669a7e1872f579cf Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Wed, 15 Jan 2020 05:57:01 +0000 Subject: [PATCH 12/15] Updating changelog [ci skip] --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 214d5efc..2d5b4a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## [Unreleased](https://github.com/jrnl-org/jrnl/) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.1.1...HEAD) @@ -13,6 +13,7 @@ **Build:** +- Automagically update the changelog you see before your very eyes! [\#806](https://github.com/jrnl-org/jrnl/pull/806) ([wren](https://github.com/wren)) - Update Black version and lock file to fix builds on develop branch [\#784](https://github.com/jrnl-org/jrnl/pull/784) ([wren](https://github.com/wren)) - Run black formatter on codebase for standardization [\#778](https://github.com/jrnl-org/jrnl/pull/778) ([wren](https://github.com/wren)) - Skip Broken Windows Tests [\#772](https://github.com/jrnl-org/jrnl/pull/772) ([wren](https://github.com/wren)) @@ -283,3 +284,5 @@ * __0.0.1__ Composing entries works. That's pretty much it. + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* From 284db07a05b4c41557c65b88d56c7e820d68c349 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Wed, 15 Jan 2020 06:16:04 +0000 Subject: [PATCH 13/15] Updating changelog [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d5b4a5f..a3be2742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ **Build:** +- Change PyPI auth method in build pipeline [\#807](https://github.com/jrnl-org/jrnl/pull/807) ([wren](https://github.com/wren)) - Automagically update the changelog you see before your very eyes! [\#806](https://github.com/jrnl-org/jrnl/pull/806) ([wren](https://github.com/wren)) - Update Black version and lock file to fix builds on develop branch [\#784](https://github.com/jrnl-org/jrnl/pull/784) ([wren](https://github.com/wren)) - Run black formatter on codebase for standardization [\#778](https://github.com/jrnl-org/jrnl/pull/778) ([wren](https://github.com/wren)) From b4be6fa161ff1b95309a74d06e376df355be341c Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Fri, 17 Jan 2020 03:03:35 +0000 Subject: [PATCH 14/15] Updating changelog [ci skip] --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3be2742..d2f3a7a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - Refactor password logic to prevent accidental password leakage [\#708](https://github.com/jrnl-org/jrnl/pull/708) ([pspeter](https://github.com/pspeter)) - Password confirmation [\#706](https://github.com/jrnl-org/jrnl/pull/706) ([pspeter](https://github.com/pspeter)) +**Fixed bugs:** + +- Close temp file before passing it to editor to prevent file locking issues in Windows [\#792](https://github.com/jrnl-org/jrnl/pull/792) ([micahellison](https://github.com/micahellison)) + **Build:** - Change PyPI auth method in build pipeline [\#807](https://github.com/jrnl-org/jrnl/pull/807) ([wren](https://github.com/wren)) From 306e048f19ded86a96c55283a075b3fa2bdbe66b Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Fri, 17 Jan 2020 03:21:23 +0000 Subject: [PATCH 15/15] Updating changelog [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f3a7a4..de50e8c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ **Fixed bugs:** - Close temp file before passing it to editor to prevent file locking issues in Windows [\#792](https://github.com/jrnl-org/jrnl/pull/792) ([micahellison](https://github.com/micahellison)) +- Fix crash while encrypting a journal on first run without saving password [\#789](https://github.com/jrnl-org/jrnl/pull/789) ([dbxnr](https://github.com/dbxnr)) **Build:**