mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-04-26 08:18:18 -05:00
build system for faster releases
making a release is less tedious with these new utilities. * bump can bump the patch, minor, or major version, and returns the new version. * release can commit the files changed by bump, then tag, build, and zip.
This commit is contained in:
parent
9fac7032e6
commit
4ca642c1c2
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -7,10 +7,6 @@ launchSettings.json
|
|||
# example binary files
|
||||
sampleFiles/
|
||||
|
||||
# in development build system
|
||||
bump.py
|
||||
release.sh
|
||||
|
||||
# Build results
|
||||
artifacts/
|
||||
obj/
|
||||
|
|
|
|||
36
bump.py
Normal file
36
bump.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# python -m bump
|
||||
# python -m bump minor
|
||||
# python -m bump major
|
||||
import sys
|
||||
|
||||
def main(arg):
|
||||
lines = []
|
||||
new_version = ''
|
||||
with open('src/SharedAssemblyInfo.cs') as file:
|
||||
for line in file:
|
||||
lines.append(line)
|
||||
|
||||
with open('src/SharedAssemblyInfo.cs', 'w') as file:
|
||||
for line in lines:
|
||||
if not 'AssemblyVersion' in line and not 'AssemblyFileVersion' in line:
|
||||
file.write(line)
|
||||
continue
|
||||
parts = line.split('"')
|
||||
version = parts[1].split('.')
|
||||
while len(version) < 4: version.append('0')
|
||||
i = 3
|
||||
if arg == 'major': i = 1
|
||||
if arg == 'minor': i = 2
|
||||
version[i] = str(int(version[i])+1)
|
||||
if i < 3: version[3] = '0'
|
||||
if i < 2: version[2] = '0'
|
||||
if version[3] == '0': del version[3]
|
||||
parts[1] = '.'.join(version)
|
||||
file.write('"'.join(parts))
|
||||
new_version = '.'.join(version)
|
||||
|
||||
return new_version
|
||||
|
||||
if __name__ == '__main__':
|
||||
arg = sys.argv[1] if len(sys.argv) > 1 else ''
|
||||
print(main(arg))
|
||||
24
release.sh
Normal file
24
release.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
version=`python -m bump`
|
||||
git commit -a -m "version bump"
|
||||
git tag v$version
|
||||
|
||||
rm -r artifacts/HexManiac.WPF/bin
|
||||
dotnet build -c Debug -p:Platform=x64
|
||||
dotnet build -c Release -p:Platform=x64
|
||||
cd artifacts/HexManiac.WPF/bin/Debug/net6.0-windows
|
||||
zip ../../../../../HexManiacAdvance_x64.$version.debug.zip -r .
|
||||
cd ../../Release/net6.0-windows
|
||||
zip ../../../../../HexManiacAdvance_x64.$version.zip -r .
|
||||
cd ../../../../..
|
||||
|
||||
rm -r artifacts/HexManiac.WPF/bin
|
||||
dotnet build -c Release -p:Platform=x86
|
||||
cd artifacts/HexManiac.WPF/bin/Release/net6.0-windows
|
||||
zip ../../../../../HexManiacAdvance_x86.$version.zip -r .
|
||||
cd ../../../../..
|
||||
|
||||
cp *.zip sampleFiles/in_flight/old_zips
|
||||
|
||||
echo $version
|
||||
echo "use 'git push origin v$version' to publish this release to GitHub."
|
||||
Loading…
Reference in New Issue
Block a user