Skip to content
Snippets Groups Projects
Verified Commit 0a6722f7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: release process

parent ea2b52f2
No related branches found
No related tags found
No related merge requests found
......@@ -480,7 +480,7 @@ tags
# End of https://www.toptal.com/developers/gitignore/api/go,git,vim,node,yarn,dbeaver,netbeans,phpstorm,intellij+all,intellij+iml,visualstudiocode
.npmrc
.attach*
.devenv*
devenv.local.nix
......
## [9.9.9] - 2023-06-19
## [3.51.5] - 2023-11-01
### Bug Fixes
- test release process
- test release process
- test release process
- test release process
### Changes
- update release process
- add buils-and-publish
- conversion of the repos to nix packagemanger [#125](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/125)
## [v3.51.4] - 2023-06-19
......
# THIS FILE IS AUTOGENERATED BY THE DEVENVSHELL
# DO NOT EDIT THIS FILE MANUALLY
# INSTEAD EDIT THE DEVENVSHELL CONFIGURATION FILE devenv.nix
# AND OPEN A SHELL WITH THE COMMAND devenv shell
#
# Information about the task runner can be found here:
# https://taskfile.dev
......@@ -16,6 +10,7 @@ tasks:
silent: true
commit:
silent: true
desc: Commit changes to the repository.
aliases:
- c
......@@ -23,6 +18,7 @@ tasks:
- do-commit
build-doc:
silent: true
desc: Build the documentation to dist/doc
aliases:
- bd
......@@ -30,6 +26,7 @@ tasks:
- build-doc
run-tests:
silent: true
desc: Run the tests
aliases:
- rt
......@@ -37,8 +34,17 @@ tasks:
- run-tests
run-web-tests:
silent: true
desc: Run the tests
aliases:
- rt
cmds:
- run-web-tests
build-and-publish:
silent: true
desc: Build the app and publish it to the npm registry
aliases:
- bp
cmds:
- build-and-publish
\ No newline at end of file
......@@ -72,55 +72,6 @@ fi
${pkgs.nodejs_20}/bin/node ${config.devenv.root}/node_modules/jsdoc-plantuml/fixBrokenNodeJS.js
cat <<'EOF' > Taskfile.yml
# THIS FILE IS AUTOGENERATED BY THE DEVENVSHELL
# DO NOT EDIT THIS FILE MANUALLY
# INSTEAD EDIT THE DEVENVSHELL CONFIGURATION FILE devenv.nix
# AND OPEN A SHELL WITH THE COMMAND devenv shell
#
# Information about the task runner can be found here:
# https://taskfile.dev
version: '3'
tasks:
default:
cmds:
- task --list
silent: true
commit:
desc: Commit changes to the repository.
aliases:
- c
cmds:
- do-commit
build-doc:
desc: Build the documentation to dist/doc
aliases:
- bd
cmds:
- build-doc
run-tests:
desc: Run the tests
aliases:
- rt
cmds:
- run-tests
run-web-tests:
desc: Run the tests
aliases:
- rt
cmds:
- run-web-tests
EOF
'';
scripts.build-changelog.exec = ''
......@@ -129,7 +80,7 @@ ${pkgs.git-chglog}/bin/git-chglog --config ${config.devenv.root}/.chglog/config.
scripts.build-and-publish.exec = ''
set -x
if [ -t 1 ]; then
RED='\033[0;31m'
GREEN='\033[0;32m'
......@@ -141,7 +92,15 @@ else
RESET=""
fi
NEXTVERSION="$(${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/version predict --git -0)"
if [[ -n "$(git status --porcelain)" ]]; then
echo -e "''${RED}✖ Git is not clean. Exiting.''${RESET}"
echo -e " You must commit all changes before you can publish a new version."
exit 1
fi
NEXTVERSION="$(${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/version predict --git)"
if [[ "$NEXTVERSION" =~ "No notable changes found." ]]; then
echo -e "''${RED}✖ No notable changes found. Exiting.''${RESET}"
......@@ -150,8 +109,13 @@ if [[ "$NEXTVERSION" =~ "No notable changes found." ]]; then
exit 1
fi
echo -e "''${GREEN}✔''${RESET} New version: $NEXTVERSION"
LASTVERSION=$(cat "${config.devenv.root}/package.json" | jq -r '.version')
jq ".version = \"$NEXTVERSION\"" "${config.devenv.root}/package.json" | ${pkgs.moreutils}/bin/sponge "${config.devenv.root}/package.json"
update-versions
PROJECT_ROOT="${config.devenv.root}/"
TEST_PATH="${config.devenv.root}/test/"
BUILD_PATH="${config.devenv.root}/dist/"
......@@ -165,7 +129,6 @@ mkdir -p "''${BUILD_PATH}"
${pkgs.git-chglog}/bin/git-chglog --next-tag ''$NEXTVERSION --config "${config.devenv.root}/.chglog/config.yml" \
-o "${config.devenv.root}/CHANGELOG.md"
${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}"
......@@ -174,24 +137,23 @@ 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 ''${APPLICATION_PATH}package.json
#git add ''${DEVELOPMENT_PATH}package.json
#git add ''${APPLICATION_PATH}source/types/version.mjs
#git add ''${TEST_PATH}cases/monster.mjs
#git add ''${PROJECT_ROOT}release.json
#git commit -m "release and publish to npm"
#rm $BUILD_PATH/pnpm-lock.yaml
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
fi
cd ''${BUILD_PATH}
OPTIONS=""
if [ ! -f "${config.devenv.root}/.npmrc" ]; then
echo -e "''${RED}✖ No npmrc file found. Exiting.''${RESET}"
echo -e " Create a file named .npmrc in the root of this repository with the following content:"
echo -e "''${RED}✖ No .npmrc file found.''${RESET}"
echo -e " If you want to publish to npm, you need to create a .npmrc file in the root of the project."
echo -e " //registry.npmjs.org/:_authToken=$NPM_TOKEN"
echo -e " You can find the token in the npm account settings."
echo -e "\n We run in dry-run mode now."
......@@ -199,17 +161,38 @@ if [ ! -f "${config.devenv.root}/.npmrc" ]; then
fi
pnpm publish $OPTIONS --dry-run --access public
exitcode=$?
cd -
set -x
if [ -n "$OPTIONS" ] || [ $exitcode -ne 0 ]; then
## reset to last version
jq ".version = \"$LASTVERSION\"" "${config.devenv.root}/package.json" | ${pkgs.moreutils}/bin/sponge "${config.devenv.root}/package.json"
update-versions
echo -e "''${RED}✖ Publishing failed. Exiting.''${RESET}"
git reset --hard HEAD~1
exit 1
fi
git tag -a ''$NEXTVERSION -m "chore tag new version $NEXTVERSION"
echo -e "''${GREEN}✔''${RESET} Publishing successful."
'';
scripts.update-versions.exec = ''
VERSION=$(cat "${config.devenv.root}/release.json" | jq -r '.version')
VERSION=$(${pkgs.coreutils}/bin/cat "${config.devenv.root}/package.json" | jq -r '.version')
${pkgs.jq}/bin/jq ".version = \"$VERSION\"" "${config.devenv.root}/package.json" | ${pkgs.moreutils}/bin/sponge "${config.devenv.root}/package.json"
${pkgs.gnused}/bin/sed -i -E "s_(\"[0-9]+\.[0-9]+\.[0-9]+\")_\"''${VERSION}\"_g" "${config.devenv.root}/source/types/version.mjs"
${pkgs.gnused}/bin/sed -i -E "s_(\"[0-9]+\.[0-9]+\.[0-9]+\")_\"''${VERSION}\"_g" "${config.devenv.root}/test/cases/monster.mjs"
sed -i -E "s_(\"[0-9]+\.[0-9]+\.[0-9]+\")_\"''${VERSION}\"_g" "${config.devenv.root}/source/types/version.mjs"
sed -i -E "s_(\"[0-9]+\.[0-9]+\.[0-9]+\")_\"''${VERSION}\"_g" "${config.devenv.root}/test/cases/monster.mjs"
'';
scripts.create-polifill.exec = ''
......@@ -246,7 +229,7 @@ PROJECT_ROOT="${config.devenv.root}"
TEST_PATH="${config.devenv.root}/test/"
TEST_CASES_PATH="${config.devenv.root}/test/cases/"
VERSION=$(cat "${config.devenv.root}/release.json" | jq -r '.version')
VERSION=$(cat "${config.devenv.root}/package.json" | jq -r '.version')
update-versions
build-monster-mjs
......
{"version":"3.51.4"}
......@@ -129,3 +129,5 @@ export { Monster };
* @memberOf Monster
*/
class Monster {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment