Skip to content

Commit b531d12

Browse files
committed
Remove VERSION from build.sh for safety
- build.sh now dynamically extracts version from .csproj using get-version.sh - bump-version.sh no longer modifies build.sh - Release workflow only commits .csproj and README.md changes - Single source of truth: LocalizationManager.csproj - Build scripts are never modified by automation (safer approach)
1 parent 320f6de commit b531d12

3 files changed

Lines changed: 8 additions & 23 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
run: |
8383
git config user.name "github-actions[bot]"
8484
git config user.email "github-actions[bot]@users.noreply.github.com"
85-
git add LocalizationManager.csproj build.sh README.md
85+
git add LocalizationManager.csproj README.md
8686
git commit -m "Bump version to ${{ steps.version.outputs.version }} [skip ci]"
8787
8888
- name: Push version commit to main

build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ BLUE='\033[0;34m'
1515
NC='\033[0m' # No Color
1616

1717
# Script configuration
18-
VERSION="0.6.2"
1918
PROJECT_NAME="LocalizationManager"
2019
OUTPUT_DIR="publish"
2120

21+
# Get version dynamically from .csproj (single source of truth)
22+
if [ -x "./get-version.sh" ]; then
23+
VERSION=$(./get-version.sh)
24+
else
25+
VERSION="unknown"
26+
fi
27+
2228
echo -e "${BLUE}╔════════════════════════════════════════════════════════════════╗${NC}"
2329
echo -e "${BLUE}║ Localization Resource Manager (LRM) - Build Script v${VERSION}${NC}"
2430
echo -e "${BLUE}╚════════════════════════════════════════════════════════════════╝${NC}"

bump-version.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ NC='\033[0m' # No Color
1313

1414
# Files to update
1515
CSPROJ_FILE="LocalizationManager.csproj"
16-
BUILD_SCRIPT="build.sh"
1716
README_FILE="README.md"
1817

1918
# Function to display usage
@@ -109,20 +108,6 @@ update_csproj() {
109108
sed -i "s|<FileVersion>$old_assembly</FileVersion>|<FileVersion>$new_assembly</FileVersion>|g" "$CSPROJ_FILE"
110109
}
111110

112-
# Function to update build.sh
113-
update_build_script() {
114-
local old_version=$1
115-
local new_version=$2
116-
117-
if [ ! -f "$BUILD_SCRIPT" ]; then
118-
echo -e "${YELLOW}⚠ Warning: $BUILD_SCRIPT not found, skipping${NC}"
119-
return
120-
fi
121-
122-
# Update VERSION variable
123-
sed -i "s|VERSION=\"$old_version\"|VERSION=\"$new_version\"|g" "$BUILD_SCRIPT"
124-
}
125-
126111
# Function to update README.md
127112
update_readme() {
128113
local old_version=$1
@@ -188,7 +173,6 @@ main() {
188173
echo ""
189174
echo "Files to update:"
190175
echo -e " ${BLUE}${NC} $CSPROJ_FILE"
191-
[ -f "$BUILD_SCRIPT" ] && echo -e " ${BLUE}${NC} $BUILD_SCRIPT"
192176
[ -f "$README_FILE" ] && echo -e " ${BLUE}${NC} $README_FILE"
193177
echo ""
194178

@@ -209,11 +193,6 @@ main() {
209193
update_csproj "$CURRENT_VERSION" "$NEW_VERSION"
210194
echo -e "${GREEN}${NC} Updated $CSPROJ_FILE"
211195

212-
if [ -f "$BUILD_SCRIPT" ]; then
213-
update_build_script "$CURRENT_VERSION" "$NEW_VERSION"
214-
echo -e "${GREEN}${NC} Updated $BUILD_SCRIPT"
215-
fi
216-
217196
if [ -f "$README_FILE" ]; then
218197
update_readme "$CURRENT_VERSION" "$NEW_VERSION"
219198
echo -e "${GREEN}${NC} Updated $README_FILE"

0 commit comments

Comments
 (0)