Something went wrong on our end
Select Git revision
-
Volker Schukai authoredVolker Schukai authored
devenv.nix 27.19 KiB
echo_section "Build and publish"
echo_step "Update auto-generated files"
#update-files
${script-build-stylesheets}/bin/build-stylesheets
#build-monster-file
echo_step "Check if git is clean"
if [[ -n "$(git status --porcelain)" ]]; then
echo_fail "Git is not clean. Exiting."
echo_hint "You must commit all changes before you can publish a new version."
# exit 1
fi
set -x
echo_step "Get next version"
NEXTVERSION="$(${versionBin} predict --git -0)"
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo_fail "Version prediction failed. Exiting."
echo_hint "You must add a new commit with feat: or fix: in the commit message to trigger a new version."
echo_hint "You can also run the version script manually to see the error message."
exit 1
fi
echo_ok "New version: $NEXTVERSION"
echo_step "Update package.json and version.mjs"
LASTVERSION=${packageData.version}
#jq ".version = \"$NEXTVERSION\"" "${config.devenv.root}/package.json" | ${pkgs.moreutils}/bin/sponge "${config.devenv.root}/package.json"
#update-versions
echo_ok "Package.json and version.mjs updated"
PROJECT_ROOT="/"
TEST_PATH="/test/"
BUILD_PATH="/dist/"
if [ -d "$BUILD_PATH" ]; then
echo_step "Remove old build directory"
rm -rf "$BUILD_PATH"
fi
pwd
ls -lah
echo_step "Create new build directory"
mkdir -p "''${BUILD_PATH}"
echo_step "Build changelog"
${pkgs.git-chglog}/bin/git-chglog --next-tag ''$NEXTVERSION --config "${config.devenv.root}/.chglog/config.yml" \
-o "${config.devenv.root}/CHANGELOG.md"
echo_step "Copy files to build directory"
${pkgs.rsync}/bin/rsync -a --exclude-from="${config.devenv.root}/.gitignore" "${config.devenv.root}/source" "''${BUILD_PATH}"
${pkgs.rsync}/bin/rsync -a --exclude-from="${config.devenv.root}/.gitignore" "${config.devenv.root}/test" "''${BUILD_PATH}"
${pkgs.rsync}/bin/rsync -a --exclude-from="${config.devenv.root}/.gitignore" "${config.devenv.root}/example" "''${BUILD_PATH}"
cp ${config.devenv.root}/README.md "''${BUILD_PATH}"
cp ${config.devenv.root}/LICENSE "''${BUILD_PATH}"
cp ${config.devenv.root}/CHANGELOG.md "''${BUILD_PATH}"
jq 'del(.devDependencies)' ${config.devenv.root}/package.json > "''${BUILD_PATH}/package.json"
git add ${config.devenv.root}/package.json
git add ${config.devenv.root}/source/types/version.mjs
git add ${config.devenv.root}/CHANGELOG.md
git add ${config.devenv.root}/test/cases/monster.mjs
if ! git commit -m "chore: release and publish to npm new version $NEXTVERSION" ; then
echo -e "''${RED}✖ Commit failed. Exiting.''${RESET}"
exit 1