Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
71 lines (59 sloc)
1.67 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| if [ "$#" -ne 2 ]; then | |
| echo "Must provide exactly two arguments." | |
| echo "First one must be the new version number." | |
| echo "Second one must be the minimum obsidian version for this release." | |
| echo "" | |
| echo "Example usage:" | |
| echo "./release.sh 0.3.0 0.11.13" | |
| echo "Exiting." | |
| exit 1 | |
| fi | |
| if [[ $(git status --porcelain) ]]; then | |
| echo "Changes in the git repo." | |
| echo "Exiting." | |
| exit 1 | |
| fi | |
| NEW_VERSION=$1 | |
| MINIMUM_OBSIDIAN_VERSION=$2 | |
| echo "Updating to version ${NEW_VERSION} with minimum obsidian version ${MINIMUM_OBSIDIAN_VERSION}" | |
| read -p "Continue? [y/N] " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]] | |
| then | |
| echo "Updating package.json" | |
| TEMP_FILE=$(mktemp) | |
| jq ".version |= \"${NEW_VERSION}\"" package.json > "$TEMP_FILE" || exit 1 | |
| mv "$TEMP_FILE" package.json | |
| echo "Updating manifest.json" | |
| TEMP_FILE=$(mktemp) | |
| jq ".version |= \"${NEW_VERSION}\" | .minAppVersion |= \"${MINIMUM_OBSIDIAN_VERSION}\"" manifest.json > "$TEMP_FILE" || exit 1 | |
| mv "$TEMP_FILE" manifest.json | |
| echo "Updating versions.json" | |
| TEMP_FILE=$(mktemp) | |
| jq ". += {\"${NEW_VERSION}\": \"${MINIMUM_OBSIDIAN_VERSION}\"}" versions.json > "$TEMP_FILE" || exit 1 | |
| mv "$TEMP_FILE" versions.json | |
| read -p "Create git commit, tag, and push? [y/N] " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]] | |
| then | |
| git add -A . | |
| git commit -m"Update to version ${NEW_VERSION}" | |
| git tag "${NEW_VERSION}" | |
| git push | |
| LEFTHOOK=0 git push --tags | |
| fi | |
| read -p "Update documentation? [y/N] " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]] | |
| then | |
| git switch gh-pages | |
| git merge main | |
| LEFTHOOK=0 git push | |
| git switch - | |
| fi | |
| else | |
| echo "Exiting." | |
| exit 1 | |
| fi |