Create and upload new release automatically

This commit is contained in:
Daniel García 2018-12-16 15:14:48 +01:00
parent d3c08a554f
commit e55e7985de
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
4 changed files with 42 additions and 9 deletions

7
.gitignore vendored
View file

@ -1,4 +1,5 @@
build/
src/
builds/
web-vault/
*.tar.gz
*.tar.gz
*.tar.gz.text

View file

@ -1,5 +1,7 @@
#!/bin/bash
export UPLOAD_VAULT="n"
export WEB_REF="v2.5.0"
sh package_web_vault.sh
@ -7,4 +9,10 @@ export WEB_REF="v2.6.0"
sh package_web_vault.sh
export WEB_REF="v2.6.1"
sh package_web_vault.sh
sh package_web_vault.sh
export WEB_REF="v2.7.0"
sh package_web_vault.sh
export WEB_REF="v2.7.1"
sh package_web_vault.sh

View file

@ -13,12 +13,18 @@ if [[ -z $WEB_REF ]]; then
WEB_REF=$input
fi
# Ask if the result will be uploaded to github releases
if [[ -z $UPLOAD_VAULT ]]; then
read -p "Upload the result to GitHub Releases? (y/n): " input
UPLOAD_VAULT=$input
fi
# If a patch was not provided, try to choose one
if [[ -z $PATCH_NAME ]]; then
# If a patch with the same name as the ref exists, use it
if [ -f patches/$WEB_REF.patch ]; then
echo "Patch file found, using that"
PATCH_NAME=$WEB_REF".patch"
PATCH_NAME=$WEB_REF.patch
else
echo "Patch file not found, using latest"
# If not, use the latest one
@ -29,12 +35,18 @@ fi
echo "Building git ref: " $WEB_REF
echo "Using patch: " $PATCH_NAME
VAULT_FOLDER=web-vault
OUTPUT_FOLDER=builds
OUTPUT_NAME=$OUTPUT_FOLDER/bw_web_$WEB_REF.tar.gz
OUTPUT_MSG=$OUTPUT_NAME.text
# If this is the first time, clone the project
if [ ! -d src ]; then
git clone https://github.com/bitwarden/web.git src
if [ ! -d $VAULT_FOLDER ]; then
git clone https://github.com/bitwarden/web.git $VAULT_FOLDER
mkdir OUTPUT_FOLDER
fi
cd src
cd $VAULT_FOLDER
# Clean
git checkout .
@ -66,4 +78,13 @@ find build -name "*.map" -delete
# Prepare the final archives
cd build
tar -czvf ../../bw_web_$WEB_REF.tar.gz *
tar -czvf ../../$OUTPUT_NAME *
cd ../..
if [[ $UPLOAD_VAULT =~ ^[Yy]$ ]]
then
sed "s/<VERSION>/$WEB_REF/g" release_template.md > $OUTPUT_MSG
# Install from here: https://hub.github.com/
hub release create -o -a $OUTPUT_NAME -F $OUTPUT_MSG $WEB_REF
fi

3
release_template.md Normal file
View file

@ -0,0 +1,3 @@
<VERSION>
https://github.com/bitwarden/web/releases/tag/<VERSION>