diff options
author | Joe Previte | 2021-04-08 22:01:14 +0000 |
---|---|---|
committer | Joe Previte | 2021-04-08 22:01:14 +0000 |
commit | 02a19a46ca383375350a2ca9136979448af06f99 (patch) | |
tree | 8e14c08133cee0f4cb37229902b703110a4f47d8 /update.sh | |
parent | cbd69a8e28d4b36a1d8658bdade6a0fe672260a1 (diff) | |
download | aur-02a19a46ca383375350a2ca9136979448af06f99.tar.gz |
feat: add update.sh script
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/update.sh b/update.sh new file mode 100755 index 000000000000..59e0696b11ad --- /dev/null +++ b/update.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Description: This is a script to update the version +# Run it with `sh update.sh` and it will do the following: +# 1. Update the `pkgver` in `PKGBUILD` to the latest version +# 2. Run `updpkgsums` to update the sha256 sums +# - If you don't have it installed, run `sudo pacman -S pacman-contrib` +# 3. Update the `.SRCINFO` by running: +# ```bash +# # This is the file that is used by the AUR to show package info. +# makepkg --printsrcinfo > .SRCINFO +# ``` +# 4. Push changes to GitHub: `git push` +# If you want to perform a dry run of this script run DRY_RUN=1 yarn release:prep + +set -euo pipefail + +main() { + # Check that they have updpkgsums installed + if ! command -v updpkgsums &>/dev/null; then + echo "updpkgsums could not be found." + echo "This is needed to update the sha256 sums" + echo -e "Install with: sudo pacman -S packman-contrib" + exit + fi + + ls + echo $(grep "pkgver=" PKGBUILD) + CODE_SERVER_CURRENT_VERSION=$(grep "pkgver=" PKGBUILD | cut -d "=" -f2-) + # Ask which version we should update to + # In the future, we'll automate this and determine the latest version automatically + echo "Current version: ${CODE_SERVER_CURRENT_VERSION}" + + read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE + + echo -e "Great! We'll update to $CODE_SERVER_VERSION_TO_UPDATE\n" + + sed -i "s/$CODE_SERVER_CURRENT_VERSION/$CODE_SERVER_VERSION_TO_UPDATE/" PKGBUILD + + updpkgsums + + makepkg --printsrcinfo > .SRCINFO + + echo "All updated!" +} + +main "$@" |