From 33a7b9617bfdcc7f019550024a85aee40bc16991 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sat, 9 Aug 2025 22:12:50 -0300 Subject: [PATCH] :package: build: implement automated release-build script --- scripts/build.sh | 4 +++- scripts/release.sh | 27 +++++++++++++++++++++++++++ src/env.d.ts | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 scripts/release.sh diff --git a/scripts/build.sh b/scripts/build.sh index efe32ef..eb013fd 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,8 +20,9 @@ while getopts r:o:bdh args; do h) echo "\ colorshell's build script. +use \`build:release\` for release builds. -Options: +options: -r \$file: specify gresource's target path (default: \`\$output/resources.gresource\`) -o \$path: specify the build's output directory (default: \`./build\`) -b: only target gresource in the build, keeping the file in the output dir @@ -55,6 +56,7 @@ echo "[info] bundling project" ags bundle src/app.ts $output/colorshell \ -r ./src \ -d "DEVEL=`[[ $is_devel ]] && echo -n true || echo -n false`" \ + -d "COLORSHELL_VERSION='`cat package.json | jq -r .version`'" \ -d "GRESOURCES_FILE='${gresources_file:-$output/resources.gresource}'" echo "[info] cleaning" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..e0b8bbf --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,27 @@ +set -e + +outdir="./build/release" +gresource_file='$XDG_LOCAL_HOME/colorshell/resources.gresource' # send literal variable name, so it's interpreted in the shell rather than in the build + +while getopts o:r:h args; do + case "$args" in + o) + outdir=${OPTARG} + ;; + r) + gresource_file=${OPTARG} + ;; + h) + echo "\ +colorshell's automated release-build script. + +options: + -r \$file: gresource's target path (shell-only, file is kept in \$output. default: \$XDG_LOCAL_HOME/colorshell/resources.gresource) + -o \$path: build output path (default: \`./build/release\`) + -h: show this help message" + exit 0 + ;; + esac +done + +pnpm build -o "${outdir:-./build/release}" -b -r "${gresource_file:-\$XDG_LOCAL_HOME/colorshell/resources.gresource}" diff --git a/src/env.d.ts b/src/env.d.ts index 55d4f96..cc5a405 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,6 +1,7 @@ declare const SRC: string declare const DEVEL: boolean; declare const GRESOURCES_FILE: string; +declare const VERSION: string; declare module "inline:*" { const content: string