From e4416925f9b4d1deac521c62918d008076ac6b05 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 3 Dec 2021 02:16:27 -0500 Subject: add build script to set the release version --- build/set-smapi-version.sh | 18 ++++++++++++++++++ docs/technical/smapi.md | 13 ++++++------- src/SMAPI.sln | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 build/set-smapi-version.sh diff --git a/build/set-smapi-version.sh b/build/set-smapi-version.sh new file mode 100755 index 00000000..42174cae --- /dev/null +++ b/build/set-smapi-version.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# get version number +version="$1" +if [ $# -eq 0 ]; then + echo "SMAPI release version (like '4.0.0'):" + read version +fi + +# move to SMAPI root +cd "`dirname "$0"`/.." + +# apply changes +sed "s/.+<\/Version>/$version<\/Version>/" "build/common.targets" --in-place --regexp-extended +sed "s/RawApiVersion = \".+?\";/RawApiVersion = \"$version\";/" "src/SMAPI/Constants.cs" --in-place --regexp-extended +for modName in "ConsoleCommands" "ErrorHandler" "SaveBackup"; do + sed "s/\"(Version|MinimumApiVersion)\": \".+?\"/\"\1\": \"$version\"/g" "src/SMAPI.Mods.$modName/manifest.json" --in-place --regexp-extended +done diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index ce1220f1..f2e030d8 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -116,16 +116,15 @@ To launch the game: 2. Launch the game through the Steam UI. #### Prepare the release -1. Update the version numbers in `build/common.targets`, `Constants`, and the `manifest.json` for - bundled mods. Make sure you use a [semantic version](https://semver.org). Recommended format: +1. Run `build/set-smapi-version.sh` to set the SMAPI version. Make sure you use a [semantic + version](https://semver.org). Recommended format: build type | format | example :--------- | :----------------------- | :------ - dev build | `-alpha.` | `3.0.0-alpha.20171230` - prerelease | `-beta.` | `3.0.0-beta.20171230` - release | `` | `3.0.0` -2. Run the `build/prepare-install-package.sh` script. This will create the release package in the - root `bin` folder. + dev build | `-alpha.` | `4.0.0-alpha.20251230` + prerelease | `-beta.` | `4.0.0-beta.20251230` + release | `` | `4.0.0` +2. Run `build/prepare-install-package.sh` to create the release package in the root `bin` folder. ### Custom Harmony build SMAPI uses [a custom build of Harmony](https://github.com/Pathoschild/Harmony#readme), which is diff --git a/src/SMAPI.sln b/src/SMAPI.sln index 9a42b9ff..961a5ff7 100644 --- a/src/SMAPI.sln +++ b/src/SMAPI.sln @@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{09CF91E5 ..\build\common.targets = ..\build\common.targets ..\build\find-game-folder.targets = ..\build\find-game-folder.targets ..\build\prepare-install-package.sh = ..\build\prepare-install-package.sh + ..\build\set-smapi-version.sh = ..\build\set-smapi-version.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{EB35A917-67B9-4EFA-8DFC-4FB49B3949BB}" -- cgit