Update release script for both wow versions
This commit is contained in:
parent
8e20f9a218
commit
4b6bac21a0
7 changed files with 177 additions and 46 deletions
156
release.sh
156
release.sh
|
@ -1,53 +1,117 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Define the file
|
||||
TOC_FILE="CzechQuests.toc"
|
||||
output_directory="CzechQuests"
|
||||
|
||||
if [[ -f "$TOC_FILE" ]]; then
|
||||
# Read version number from the file
|
||||
VERSION=$(grep "## Version:" "$TOC_FILE" | cut -d ' ' -f 3)
|
||||
echo "Version: $VERSION"
|
||||
else
|
||||
echo "File $TOC_FILE does not exist."
|
||||
fi
|
||||
|
||||
# Define the name of the zipfile
|
||||
ZIPFILE="czech-quests-v$VERSION.zip"
|
||||
|
||||
# Define the output directory
|
||||
OUT_DIR="CzechQuests"
|
||||
|
||||
# Create the output directory
|
||||
mkdir -p $OUT_DIR
|
||||
|
||||
# Define files/directories to copy
|
||||
FILES_TO_COPY="*"
|
||||
|
||||
# Define files/directories to exclude while copying
|
||||
# File names should be separated by space and wrapped in double quotes
|
||||
EXCLUDE_FILES=(
|
||||
".git"
|
||||
".idea"
|
||||
".png"
|
||||
".sh"
|
||||
"README.md"
|
||||
"czech-quest-v",
|
||||
"Data"
|
||||
$OUT_DIR
|
||||
wow_versions=(
|
||||
"Classic ERA" # 1 - classic_era
|
||||
"Retail" # 2 - retail
|
||||
)
|
||||
|
||||
# Copy files to the output directory
|
||||
for FILE in $FILES_TO_COPY
|
||||
do
|
||||
echo "Processing $FILE file..."
|
||||
if [[ ! " ${EXCLUDE_FILES[@]} " =~ " ${FILE} " ]]; then
|
||||
cp -r $FILE $OUT_DIR
|
||||
echo "Copied $FILE"
|
||||
toc_files=(
|
||||
"CzechQuests_Vanilla.toc"
|
||||
"CzechQuests_Mainline.toc"
|
||||
)
|
||||
|
||||
|
||||
read_toc_version() {
|
||||
local wow_version=$1
|
||||
local toc_file=${toc_files[$wow_version]}
|
||||
local current_version=0
|
||||
if [[ -f "$toc_file" ]]; then
|
||||
current_version=$(grep "## Version:" "$toc_file" | cut -d ' ' -f 3)
|
||||
fi
|
||||
done
|
||||
echo "$current_version"
|
||||
}
|
||||
|
||||
# Create the zip file at parent level, including the 'dist' directory
|
||||
zip -r $ZIPFILE $OUT_DIR
|
||||
write_toc_version() {
|
||||
local wow_version=$1
|
||||
local next_version=$2
|
||||
local toc_file=${toc_files[$wow_version]}
|
||||
if [[ -f "$toc_file" ]]; then
|
||||
sed -i '' "s/## Version: $current_version/## Version: $next_version/" "$toc_file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Optionally, remove the copied unzipped files in 'dist'
|
||||
rm -rf $OUT_DIR
|
||||
make_zip() {
|
||||
local wow_version=$1
|
||||
local current_version=$2
|
||||
|
||||
local zip_filename=""
|
||||
local files_to_zip=()
|
||||
|
||||
# prepare output directory
|
||||
mkdir -p $output_directory
|
||||
mkdir -p "${output_directory}/Quests/Data/"
|
||||
|
||||
# Includes classic era continents
|
||||
if [ "$wow_version" = "1" ]; then
|
||||
cp -r "./Quests/Data/classic_era/" "${output_directory}/Quests/Data/"
|
||||
cp "./CzechQuests_Vanilla.toc" "${output_directory}"
|
||||
zip_filename="czech-quests-classic_era-v$current_version.zip"
|
||||
fi
|
||||
|
||||
# Includes retail continents
|
||||
if [ "$wow_version" = "2" ]; then
|
||||
cp -r "./Quests/Data/retail/" "${output_directory}/Quests/Data/"
|
||||
cp "./CzechQuests_Mainline.toc" "${output_directory}"
|
||||
zip_filename="czech-quests-retail-v$current_version.zip"
|
||||
fi
|
||||
|
||||
# includes frames
|
||||
while IFS= read -r line; do
|
||||
files_to_zip+=("$line")
|
||||
done < <(find . -name "*.lua" -path "./Quests/Frames/*")
|
||||
|
||||
# includes other files
|
||||
files_to_zip+=("./Quests/Data/other.lua" "./Quests/Quests.lua" "./Quests/Utils.lua" "./Init.lua")
|
||||
files_to_zip+=("./morpheus_cz.ttf" "./frizquadratatt_cz.ttf")
|
||||
|
||||
# prepare output directory
|
||||
for file in "${files_to_zip[@]}"; do
|
||||
rsync -R "$file" $output_directory
|
||||
done
|
||||
|
||||
# create zip file
|
||||
zip -r "$zip_filename" $output_directory
|
||||
|
||||
# remove output directory
|
||||
rm -r $output_directory
|
||||
}
|
||||
|
||||
release_wow() {
|
||||
local wow_version=$1
|
||||
|
||||
# Read current version from file for wow version
|
||||
current_version=$(read_toc_version "$wow_version")
|
||||
|
||||
# Increase version
|
||||
new_version="$current_version"
|
||||
vared -p "Choose version: " new_version
|
||||
|
||||
# Write to file
|
||||
write_toc_version "$wow_version" "$new_version"
|
||||
|
||||
# Generate zip
|
||||
make_zip $wow_version $current_version
|
||||
}
|
||||
|
||||
init() {
|
||||
echo "Choose Wow:"
|
||||
select opt in "${wow_versions[@]}"
|
||||
do
|
||||
case $opt in
|
||||
"Classic ERA")
|
||||
echo "You chose Classic ERA"
|
||||
release_wow 1
|
||||
return 0
|
||||
;;
|
||||
"Retail")
|
||||
echo "You chose Retail"
|
||||
release_wow 2
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
init
|
Loading…
Add table
Add a link
Reference in a new issue