mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Improve version handling.
This commit is contained in:
23
manage.sh
23
manage.sh
@@ -6,9 +6,18 @@ export DEVENV_IMGNAME="$ORGANIZATION/devenv";
|
|||||||
export DEVENV_PNAME="penpotdev";
|
export DEVENV_PNAME="penpotdev";
|
||||||
|
|
||||||
export CURRENT_USER_ID=$(id -u);
|
export CURRENT_USER_ID=$(id -u);
|
||||||
export CURRENT_VERSION=$(git describe --tags);
|
export CURRENT_VERSION=$(cat ./version.txt);
|
||||||
export CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD);
|
export CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD);
|
||||||
export CURRENT_HASH=$(git rev-parse --short HEAD);
|
export CURRENT_HASH=$(git rev-parse --short HEAD);
|
||||||
|
export CURRENT_COMMITS=$(git rev-list --count HEAD)
|
||||||
|
|
||||||
|
function print-current-version {
|
||||||
|
if [ $CURRENT_BRANCH != "main" ]; then
|
||||||
|
echo -n "$CURRENT_BRANCH-$CURRENT_VERSION-$CURRENT_COMMITS-g$CURRENT_HASH"
|
||||||
|
else
|
||||||
|
echo -n "$CURRENT_VERSION-$CURRENT_COMMITS-g$CURRENT_HASH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function build-devenv {
|
function build-devenv {
|
||||||
echo "Building development image $DEVENV_IMGNAME:latest..."
|
echo "Building development image $DEVENV_IMGNAME:latest..."
|
||||||
@@ -74,7 +83,7 @@ function build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function build-app-bundle {
|
function build-app-bundle {
|
||||||
local version="$CURRENT_VERSION";
|
local version=$(print-current-version);
|
||||||
local bundle_dir="./bundle-app";
|
local bundle_dir="./bundle-app";
|
||||||
|
|
||||||
build "frontend";
|
build "frontend";
|
||||||
@@ -85,10 +94,6 @@ function build-app-bundle {
|
|||||||
cp -r ./frontend/target/dist $bundle_dir/frontend;
|
cp -r ./frontend/target/dist $bundle_dir/frontend;
|
||||||
cp -r ./backend/target/dist $bundle_dir/backend;
|
cp -r ./backend/target/dist $bundle_dir/backend;
|
||||||
|
|
||||||
if [ $CURRENT_BRANCH != "main" ]; then
|
|
||||||
version="$CURRENT_BRANCH-$CURRENT_VERSION";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
echo $version > $bundle_dir/version.txt
|
echo $version > $bundle_dir/version.txt
|
||||||
|
|
||||||
sed -i -re "s/\%version\%/$version/g" $bundle_dir/frontend/index.html;
|
sed -i -re "s/\%version\%/$version/g" $bundle_dir/frontend/index.html;
|
||||||
@@ -96,7 +101,7 @@ function build-app-bundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function build-exporter-bundle {
|
function build-exporter-bundle {
|
||||||
local version="$CURRENT_VERSION";
|
local version=$(print-current-version);
|
||||||
local bundle_dir="./bundle-exporter";
|
local bundle_dir="./bundle-exporter";
|
||||||
|
|
||||||
build "exporter";
|
build "exporter";
|
||||||
@@ -104,10 +109,6 @@ function build-exporter-bundle {
|
|||||||
rm -rf $bundle_dir;
|
rm -rf $bundle_dir;
|
||||||
cp -r ./exporter/target $bundle_dir;
|
cp -r ./exporter/target $bundle_dir;
|
||||||
|
|
||||||
if [ $CURRENT_BRANCH != "main" ]; then
|
|
||||||
version="$CURRENT_BRANCH-$CURRENT_VERSION";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
echo $version > $bundle_dir/version.txt
|
echo $version > $bundle_dir/version.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
version.txt
Normal file
1
version.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1.4.0-alpha
|
||||||
Reference in New Issue
Block a user