Skip to content
This repository was archived by the owner on Mar 26, 2021. It is now read-only.

Commit 6d068e2

Browse files
committed
Update version task
1 parent aa2c40a commit 6d068e2

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

OpenChart/installer/win-x64/setup.isl.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ AppUpdatesURL={#AppURL}
2626
DefaultDirName={autopf}\{#AppName}
2727
DisableDirPage=no
2828
DisableProgramGroupPage=yes
29-
OutputBaseFilename=Install {#AppName} v{#AppVersion}
29+
OutputBaseFilename=install-{#AppName}
3030
Compression=lzma
3131
SolidCompression=yes
3232
WizardStyle=modern

tasks.sh

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ set -e
88
~~~~~~~~~~~~~~~
99
'
1010

11+
function fnApplyVersion() {
12+
: '
13+
Updates the files in the project which reference the project version.
14+
This function expects each file to have a corresponding .template file
15+
which contains the $VERSION* vars to be substituted.
16+
'
17+
local files=(
18+
OpenChart/OpenChart.csproj
19+
OpenChart/installer/win-x64/setup.isl
20+
)
21+
22+
export VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH
23+
24+
# Update the version across the project files.
25+
for f in "${files[@]}"; do
26+
if [[ ! -e "$f.template" ]]; then
27+
echo "WARNING: Template file is missing at: $f.template"
28+
else
29+
envsubst < $f.template > $f
30+
echo "Updated $f.template --> $f"
31+
fi
32+
done
33+
}
34+
1135
function fnBuild() {
1236
: '
1337
Builds OpenChart in debug mode.
@@ -137,6 +161,11 @@ function fnVersion() {
137161
exit
138162
;;
139163

164+
apply)
165+
fnApplyVersion
166+
exit
167+
;;
168+
140169
major)
141170
VERSION_MAJOR=$((VERSION_MAJOR + 1))
142171
VERSION_MINOR=0
@@ -158,22 +187,21 @@ function fnVersion() {
158187
echo "COMMANDS"
159188
echo "If no command is given, prints the current version."
160189
echo
190+
echo " apply Applies the current version to any files which depend on it"
161191
echo " major Increments the major version"
162192
echo " minor Increments the minor version"
163193
echo " patch Increments the patch version"
164194
echo
195+
exit
165196
;;
166197
esac
167198

168-
# Write to the VERSION file.
199+
# Update the version.
169200
export VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH
170-
171201
echo $VERSION > VERSION
172202
echo "Incremented version to $VERSION"
173203

174-
# Update the version across the project files.
175-
envsubst < OpenChart/OpenChart.csproj.template > OpenChart/OpenChart.csproj
176-
envsubst < OpenChart/installer/win-x64/setup.isl.template > OpenChart/installer/win-x64/setup.isl
204+
fnApplyVersion
177205
}
178206

179207
function fnUsage() {

0 commit comments

Comments
 (0)