mirror of
https://github.com/dani-garcia/bw_web_builds.git
synced 2024-12-27 12:58:15 +03:00
0277844cf9
Some misc changes. - Moved old patch files to a `legacy` sub-folder - If a legacy patch is used, show a warning and pause for 10 seconds - Updated the checkout and Dockerfile so both use the same way of cloning the Bitwarden/client repo - Updated the `patch_web_vault.sh` script to try and detect the vault version - Added two new make commands to prepare and release a new version - Added a `.env` feature for the `Makefile` to set some defaults Mainly used for using either `docker` or `podman` and for the GitHub Release script to have a predefined GPG user/key
59 lines
1.8 KiB
Bash
Executable file
59 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -o pipefail -o errexit
|
|
|
|
# Error handling
|
|
handle_error() {
|
|
read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
|
|
exit 1
|
|
}
|
|
trap 'handle_error $LINENO $?' ERR
|
|
|
|
if ! command -v gh >/dev/null 2>&1; then
|
|
echo "gh command not found, unable te prepare a release."
|
|
exit 1
|
|
fi
|
|
|
|
current_branch=$(git branch --show-current 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null)
|
|
if [[ -n "$current_branch" && "${current_branch}" != "master" ]]; then
|
|
echo "Current branch '$current_branch' is not the 'master' branch."
|
|
echo "Please checkout and pull the master branch before you continue."
|
|
exit 1
|
|
fi
|
|
|
|
# Ask for release tag if not provided
|
|
if [[ -z "$RELEASE_TAG" ]]; then
|
|
read -rp "Provide git release tag (example: v2023.12.0): " input
|
|
RELEASE_TAG="${input}"
|
|
fi
|
|
|
|
# Check if the RELEASE_TAG starts with vYYYY.M.B and patch letters are allowed like vYYYY.M.Ba
|
|
if [[ ! "${RELEASE_TAG}" =~ ^v20[0-9]{2}\.[0-9]{1,2}.[0-9]{1}[a-z]?$ ]]; then
|
|
echo "The provided release tag does not meet our standards!"
|
|
echo "'${RELEASE_TAG}' does not match the vYYYY.M.B format."
|
|
exit 1
|
|
fi
|
|
|
|
# Verify if the input is correct
|
|
while true; do
|
|
read -rp "Using: '${RELEASE_TAG}' as tag, continue? (y/n): " yn
|
|
case $yn in
|
|
[Yy] )
|
|
# Continue with the release
|
|
break
|
|
;;
|
|
[Nn] )
|
|
echo "Aborting release"
|
|
exit 1
|
|
;;
|
|
* ) echo "Please answer y or n"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
git tag -s "${RELEASE_TAG}"
|
|
git push origin "${RELEASE_TAG}"
|
|
echo "Wait a few seconds before using gh to create a draft release"
|
|
sleep 5
|
|
gh release create "${RELEASE_TAG}" --generate-notes --draft
|
|
|
|
echo "Now wait for the container to be build and pushed before running 'make gh-release'"
|