@@ -5,35 +5,60 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55package_version=" $1 "
66
77if [[-z " $package_version " ]]; then
8- echo " Usage:$0 <package version, e.g. 2.7.12>"
8+ echo " postgresml dashboard package build and release script"
9+ echo " Usage:$0 <package version, e.g. 2.10.0>"
910exit 1
1011fi
1112
12- if [[$( arch) == " x86_64" ]]; then
13- export ARCH=amd64
14- else
15- export ARCH=arm64
16- fi
13+ # Active LTS Ubuntu versions and their codenames
14+ declare -A ubuntu_versions=(
15+ [" 20.04" ]=" focal"
16+ [" 22.04" ]=" jammy"
17+ [" 24.04" ]=" noble"
18+ )
19+
20+ # Supported architectures
21+ declare -a architectures=(" amd64" " arm64" )
1722
23+ # Install deb-s3 if not present
1824if ! which deb-s3; then
1925 curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
2026 sudo gem install deb-s3-0.11.4.gem
2127 deb-s3
2228fi
2329
2430function package_name() {
25- echo " postgresml-dashboard-${package_version} -ubuntu22.04-${ARCH} .deb"
31+ local ubuntu_version=$1
32+ local arch=$2
33+ echo " postgresml-dashboard-${package_version} -ubuntu${ubuntu_version} -${arch} .deb"
2634}
2735
28- bash${SCRIPT_DIR} /build.sh" $package_version "
36+ # Loop through Ubuntu versions
37+ for ubuntu_version in " ${! ubuntu_versions[@]} " ; do
38+ codename=${ubuntu_versions[$ubuntu_version]}
39+ echo " Building packages for Ubuntu${ubuntu_version} (${codename} )"
2940
30- if [[! -f $( package_name) ]]; then
31- echo " File$( package_name) doesn't exist"
32- exit 1
33- fi
41+ # Loop through architectures
42+ for arch in " ${architectures[@]} " ; do
43+ echo " Building for architecture:${arch} "
44+ export ARCH=${arch}
45+
46+ # Build the dashboard package
47+ bash${SCRIPT_DIR} /build.sh" $package_version " " $ubuntu_version "
48+
49+ if [[! -f $( package_name${ubuntu_version} ${arch} ) ]]; then
50+ echo " File$( package_name${ubuntu_version} ${arch} ) doesn't exist"
51+ exit 1
52+ fi
53+
54+ # Upload to S3
55+ deb-s3 upload \
56+ --lock \
57+ --bucket apt.postgresml.org \
58+ $( package_name${ubuntu_version} ${arch} ) \
59+ --codename${codename}
3460
35- deb-s3 upload \
36- --lock \
37- --bucket apt.postgresml.org \
38- $( package_name) \
39- --codename$( lsb_release -cs)
61+ # Clean up the package file
62+ rm$( package_name${ubuntu_version} ${arch} )
63+ done
64+ done