diff options
author | makamys <makamys@outlook.com> | 2022-06-04 09:31:42 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-04 09:33:13 +0200 |
commit | 24204cfdc91a9ecc5e0012d9f256a7e72f541d64 (patch) | |
tree | 233971dbe560cb416eaa0646c7bf38853daabc1b /publish/build_and_release.sh | |
parent | b0f7f36a0b26f8ae0f6c238ae1a11f68d20efa1c (diff) | |
download | Neodymium-24204cfdc91a9ecc5e0012d9f256a7e72f541d64.tar.gz Neodymium-24204cfdc91a9ecc5e0012d9f256a7e72f541d64.tar.bz2 Neodymium-24204cfdc91a9ecc5e0012d9f256a7e72f541d64.zip |
Migrate to generic buildscript
Diffstat (limited to 'publish/build_and_release.sh')
-rw-r--r-- | publish/build_and_release.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/publish/build_and_release.sh b/publish/build_and_release.sh new file mode 100644 index 0000000..5ab7fe0 --- /dev/null +++ b/publish/build_and_release.sh @@ -0,0 +1,43 @@ +if [ ! -s changelog.md ]; then + echo "Changelog is empty, refusing to publish." + exit 3 +fi + +if [[ $(git diff --cached --stat) != '' ]] +then + echo "There are staged uncommitted changes, refusing to publish." + exit 2 +fi + +if [ "$#" -lt 1 ] || [ "$#" -gt 3 ] +then + echo "Usage: $0 GITHUB_TOKEN CURSEFORGE_TOKEN [MODRINTH_TOKEN]" + exit 1 +fi + +# exit when any command fails +set -e + +GITHUB_TOKEN=$1 +CURSEFORGE_TOKEN=$2 +MODRINTH_TOKEN=$3 + +# build the release +./gradlew cleanBuildAll + +# release +py prepare_publish.py +./gradlew githubRelease -PgithubToken=$GITHUB_TOKEN +py update_updatejson.py + +if [ -n "$CURSEFORGE_TOKEN" ] +then + ./curseforge_all.sh -PcurseToken=$CURSEFORGE_TOKEN +fi + +/dev/null > changelog.md + +if [ -n "$MODRINTH_TOKEN" ] +then + ./modrinth_all.sh -PmodrinthToken=$MODRINTH_TOKEN +fi
\ No newline at end of file |